Skip to content

Commit

Permalink
Merge pull request #148 from matteobortolazzo/dev
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
matteobortolazzo authored Oct 14, 2021
2 parents 8c09f3b + d70cd83 commit 0c39973
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/CouchDB.Driver/Types/CouchDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected CouchDocument()

// This must be for serialization only field
[DataMember]
[JsonProperty("_attachments")]
[JsonProperty("_attachments", NullValueHandling = NullValueHandling.Ignore)]
private Dictionary<string, CouchAttachment> AttachmentsParsed { get; set; }

[JsonIgnore]
Expand Down
4 changes: 2 additions & 2 deletions tests/CouchDB.Driver.UnitTests/CouchDbContext_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ await context.OtherRebels.AddAsync(new OtherRebel
var result = await context.OtherRebels.ToListAsync();
Assert.NotEmpty(result);
Assert.Equal("Luke", result[0].Name);
Assert.Equal(@"{""_conflicts"":[],""name"":""Leia"",""age"":0,""split_discriminator"":""SimpleRebel""}", httpTest.CallLog[0].RequestBody);
Assert.Equal(@"{""_conflicts"":[],""rebel_bith_date"":""0001-01-01T00:00:00"",""name"":""Luke"",""age"":0,""isJedi"":false,""species"":0,""guid"":""00000000-0000-0000-0000-000000000000"",""split_discriminator"":""OtherRebel""}", httpTest.CallLog[1].RequestBody);
Assert.Equal(@"{""_conflicts"":[],""name"":""Leia"",""age"":0,""split_discriminator"":""SimpleRebel"",""_attachments"":{}}", httpTest.CallLog[0].RequestBody);
Assert.Equal(@"{""_conflicts"":[],""rebel_bith_date"":""0001-01-01T00:00:00"",""name"":""Luke"",""age"":0,""isJedi"":false,""species"":0,""guid"":""00000000-0000-0000-0000-000000000000"",""split_discriminator"":""OtherRebel"",""_attachments"":{}}", httpTest.CallLog[1].RequestBody);
Assert.Equal(@"{""selector"":{""split_discriminator"":""OtherRebel""}}", httpTest.CallLog[2].RequestBody);
}

Expand Down
6 changes: 3 additions & 3 deletions tests/CouchDB.Driver.UnitTests/Settings_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public async Task PropertyNullValueHandling_NotSet()

var call = httpTest.CallLog.First();
Assert.NotNull(call);
Assert.Equal(@"{""_conflicts"":[],""age"":0,""isJedi"":false,""species"":0,""guid"":""00000000-0000-0000-0000-000000000000""}", call.RequestBody);
Assert.Equal(@"{""_conflicts"":[],""age"":0,""isJedi"":false,""species"":0,""guid"":""00000000-0000-0000-0000-000000000000"",""_attachments"":{}}", call.RequestBody);
}

[Fact]
Expand All @@ -222,7 +222,7 @@ public async Task PropertyNullValueHandling_Includes()

var call = httpTest.CallLog.First();
Assert.NotNull(call);
Assert.Equal(@"{""_conflicts"":[],""name"":null,""surname"":null,""age"":0,""isJedi"":false,""species"":0,""guid"":""00000000-0000-0000-0000-000000000000"",""skills"":null,""battles"":null,""vehicle"":null}", call.RequestBody);
Assert.Equal(@"{""_conflicts"":[],""name"":null,""surname"":null,""age"":0,""isJedi"":false,""species"":0,""guid"":""00000000-0000-0000-0000-000000000000"",""skills"":null,""battles"":null,""vehicle"":null,""_attachments"":{}}", call.RequestBody);
}

[Fact]
Expand All @@ -238,7 +238,7 @@ public async Task PropertyNullValueHandling_Ignore()

var call = httpTest.CallLog.First();
Assert.NotNull(call);
Assert.Equal(@"{""_conflicts"":[],""age"":0,""isJedi"":false,""species"":0,""guid"":""00000000-0000-0000-0000-000000000000""}", call.RequestBody);
Assert.Equal(@"{""_conflicts"":[],""age"":0,""isJedi"":false,""species"":0,""guid"":""00000000-0000-0000-0000-000000000000"",""_attachments"":{}}", call.RequestBody);
}

#endregion
Expand Down

0 comments on commit 0c39973

Please sign in to comment.