Skip to content

Commit 7dc0860

Browse files
CopilotStefH
andcommitted
Improve test assertions: verify expected result counts for Instant comparisons
Agent-Logs-Url: https://github.com/zzzprojects/System.Linq.Dynamic.Core/sessions/b497145d-ba3d-430a-b608-eda596efffdd Co-authored-by: StefH <249938+StefH@users.noreply.github.com>
1 parent 2050e63 commit 7dc0860

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

test/System.Linq.Dynamic.Core.Tests/TypeConvertors/NodaTimeConverterTests.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ private class EntityWithInstant
165165
}
166166

167167
[Theory]
168-
[InlineData(">")]
169-
[InlineData(">=")]
170-
[InlineData("<")]
171-
[InlineData("<=")]
172-
public void FilterByInstant_WithRelationalOperator(string op)
168+
[InlineData(">", 1)]
169+
[InlineData(">=", 2)]
170+
[InlineData("<", 1)]
171+
[InlineData("<=", 2)]
172+
public void FilterByInstant_WithRelationalOperator(string op, int expectedCount)
173173
{
174174
// Arrange
175175
var now = SystemClock.Instance.GetCurrentInstant();
@@ -184,15 +184,15 @@ public void FilterByInstant_WithRelationalOperator(string op)
184184
var result = data.Where($"Timestamp {op} @0", now).ToList();
185185

186186
// Assert
187-
result.Should().NotBeNull();
187+
result.Should().HaveCount(expectedCount);
188188
}
189189

190190
[Theory]
191-
[InlineData(">")]
192-
[InlineData(">=")]
193-
[InlineData("<")]
194-
[InlineData("<=")]
195-
public void FilterByNullableInstant_WithRelationalOperator(string op)
191+
[InlineData(">", 1)]
192+
[InlineData(">=", 2)]
193+
[InlineData("<", 1)]
194+
[InlineData("<=", 2)]
195+
public void FilterByNullableInstant_WithRelationalOperator(string op, int expectedCount)
196196
{
197197
// Arrange
198198
var now = SystemClock.Instance.GetCurrentInstant();
@@ -207,8 +207,8 @@ public void FilterByNullableInstant_WithRelationalOperator(string op)
207207
// Act
208208
var result = data.Where($"TimestampNullable {op} @0", now).ToList();
209209

210-
// Assert
211-
result.Should().NotBeNull();
210+
// Assert - null values are excluded from comparison results
211+
result.Should().HaveCount(expectedCount);
212212
}
213213

214214
public class LocalDateConverter : TypeConverter

0 commit comments

Comments
 (0)