3.9 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T03:51:03.653495+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 574ef8550b69736d |
DTS.Common.DataModel.Tests
Documentation Page: GroupShould.cs Unit Tests
1. Purpose
This file contains unit tests for the Group class in the GroupList.Model namespace, specifically validating the behavior of its Filter method and ConvertToEmbedded method. The tests ensure that filtering logic correctly handles edge cases (null/empty search terms, missing associated test setups), searches across multiple properties (DisplayName, Description, ChannelCount, LastModified), and that ConvertToEmbedded behaves idempotently when invoked on an already-embedded group.
2. Public Interface
The tests reference the following public members of the Group class (defined externally, not in this file):
-
bool Filter(string term)
Performs a case-sensitive substring search acrossDisplayName,Description,ChannelCount(as string), andLastModified(as string, using defaultToString()). Returnstrueif any field contains the search term (or iftermis null/empty, or ifAssociatedTestSetupsis null), otherwisefalse. -
void ConvertToEmbedded(IGroupChannel[] channels)
Converts theGroupinstance to an embedded state. Tests confirm that invoking this method on a group withEmbedded = truedoes not cause an exception and leavesEmbeddedastrue. (Full behavior of this method is not fully specified by the tests.)
3. Invariants
Filter("")andFilter(null)must returntrue.- If
AssociatedTestSetupsisnull,Filter(term)must returntrue(regardless ofterm). Filter(term)returnstrueiftermis a substring of:DisplayName,Description,ChannelCount.ToString(), orLastModified.ToString()
(using default string conversion and case-sensitive comparison).
Filter(term)returnsfalseonly iftermis non-null/non-empty,AssociatedTestSetupsis non-null, andtermis not found in any of the above fields.ConvertToEmbeddedmust be safe to call on an already-embedded group (no exception thrown,Embeddedremainstrue).
4. Dependencies
- Internal dependencies (inferred from test setup):
GroupList.Model.Group— the class under test.Interface.Groups.GroupList.TestSetupParentHelper— used to populateAssociatedTestSetups(aList<TestSetupParentHelper>).Interface.Channels.IGroupChannel— used as the parameter type forConvertToEmbedded.
- Test framework:
NUnit(v3+), via[TestFixture]and[Test]attributes. - Dependencies on this module: None explicitly stated in this test file. Tests are internal to the
DTS.Common.DataModel.Testsnamespace.
5. Gotchas
- Case sensitivity: Tests do not verify case-insensitive matching;
Filterappears to be case-sensitive (e.g.,"abc"matches"defabchy"but not"defABChy"unless explicitly implemented otherwise — not confirmed here). - String conversion of
ChannelCountandLastModified: Uses default.ToString(); behavior may vary with culture settings (e.g.,LastModified.ToString()may produce"12/31/2023 10:00:00 AM"vs"2023-12-31T10:00:00"depending on environment). AssociatedTestSetupsnull vs empty list: Tests distinguish betweennull(returnstruefor any term) and an empty list (returnsfalseif term not found elsewhere).ConvertToEmbeddedbehavior incomplete: Tests only verify idempotency for already-embedded groups. No tests confirm behavior for non-embedded groups, side effects (e.g., channel assignment), or exception conditions.- No tests for
Embeddedproperty mutation: WhileEmbeddedis read in tests, no tests assert thatConvertToEmbeddedsets it totruewhen initiallyfalse.