Skip to content

Commit

Permalink
change
Browse files Browse the repository at this point in the history
  • Loading branch information
oskogstad committed Nov 1, 2024
1 parent 169b043 commit 33cf27a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/Digdir.Domain.Dialogporten.WebApi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ static void IgnoreEmptyCollections(JsonTypeInfo typeInfo)
{
foreach (var property in typeInfo.Properties)
{
if (property.PropertyType.IsAssignableTo(typeof(ICollection)))
if (property.PropertyType.IsGenericType &&
property.PropertyType.IsAssignableTo(typeof(ICollection)) &&
property.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>))
{
property.ShouldSerialize = (_, val) => val is ICollection collection && collection.Count > 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public async Task InitializeAsync()

AssertionOptions.AssertEquivalencyUsing(options =>
{
//options.ExcludingMissingMembers();
options.Using<DateTimeOffset>(ctx => ctx.Subject.Should().BeCloseTo(ctx.Expectation, TimeSpan.FromMicroseconds(1)))
.WhenTypeIs<DateTimeOffset>();
return options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public async Task Get_ReturnsSimpleDialog_WhenDialogExists()
response.TryPickT0(out var result, out _).Should().BeTrue();
result.Should().NotBeNull();
result.Should().BeEquivalentTo(createDialogCommand, options => options
.ExcludingMissingMembers()
.Excluding(x => x.UpdatedAt)
.Excluding(x => x.CreatedAt)
.Excluding(x => x.SystemLabel));
Expand All @@ -48,7 +47,6 @@ public async Task Get_ReturnsDialog_WhenDialogExists()
response.TryPickT0(out var result, out _).Should().BeTrue();
result.Should().NotBeNull();
result.Should().BeEquivalentTo(createCommand, options => options
.ExcludingMissingMembers()
.Excluding(x => x.UpdatedAt)
.Excluding(x => x.CreatedAt)
.Excluding(x => x.SystemLabel));
Expand Down

0 comments on commit 33cf27a

Please sign in to comment.