Skip to content

Commit b072dd5

Browse files
Pushed updates addressing review comments.
1 parent a133a32 commit b072dd5

1 file changed

Lines changed: 19 additions & 13 deletions

File tree

test/JsonApiDotNetCoreTests/IntegrationTests/Meta/RequestMetaTests.cs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
9494

9595
store.Document.Meta.Should().BeEquivalentToJson(documentMeta);
9696

97-
store.Document.Data.Should().NotBeNull();
9897
store.Document.Data.SingleValue.Should().NotBeNull();
9998

10099
store.Document.Data.SingleValue.Meta.Should().BeEquivalentToJson(resourceMeta);
@@ -527,22 +526,25 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
527526
}
528527

529528
[Fact]
530-
public async Task Accepts_meta_in_remove_from_ToOne_relationship_request()
529+
public async Task Accepts_meta_in_remove_from_ToMany_relationship_request()
531530
{
532531
// Arrange
533532
var store = _testContext.Factory.Services.GetRequiredService<RequestDocumentStore>();
534533

535534
Dictionary<string, object?> documentMeta = _fakers.DocumentMeta.GenerateOne();
536-
Dictionary<string, object?> identifierMeta = _fakers.IdentifierMeta.GenerateOne();
535+
Dictionary<string, object?> identifierMeta1 = _fakers.IdentifierMeta.GenerateOne();
536+
Dictionary<string, object?> identifierMeta2 = _fakers.IdentifierMeta.GenerateOne();
537537

538-
SupportTicket existingTicket = _fakers.SupportTicket.GenerateOne();
539538
ProductFamily existingFamily = _fakers.ProductFamily.GenerateOne();
539+
SupportTicket existingTicket1 = _fakers.SupportTicket.GenerateOne();
540+
existingTicket1.ProductFamily = existingFamily;
541+
SupportTicket existingTicket2 = _fakers.SupportTicket.GenerateOne();
542+
existingTicket2.ProductFamily = existingFamily;
540543

541544
await _testContext.RunOnDatabaseAsync(async dbContext =>
542545
{
543546
dbContext.ProductFamilies.Add(existingFamily);
544-
existingTicket.ProductFamily = existingFamily;
545-
dbContext.SupportTickets.Add(existingTicket);
547+
dbContext.SupportTickets.AddRange(existingTicket1, existingTicket2);
546548
await dbContext.SaveChangesAsync();
547549
});
548550

@@ -553,8 +555,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
553555
new
554556
{
555557
type = "supportTickets",
556-
id = existingTicket.StringId,
557-
meta = identifierMeta
558+
id = existingTicket2.StringId,
559+
meta = identifierMeta1
560+
},
561+
new
562+
{
563+
type = "supportTickets",
564+
id = existingTicket2.StringId,
565+
meta = identifierMeta2
558566
}
559567
},
560568
meta = documentMeta
@@ -570,14 +578,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
570578

571579
store.Document.Should().NotBeNull();
572580

573-
store.Document.Data.SingleValue.Should().BeNull();
574-
575581
store.Document.Meta.Should().BeEquivalentToJson(documentMeta);
576582

577-
store.Document.Data.Should().NotBeNull();
578-
store.Document.Data.ManyValue.Should().HaveCount(1);
583+
store.Document.Data.ManyValue.Should().HaveCount(2);
579584

580-
store.Document.Data.ManyValue[0].Meta.Should().BeEquivalentToJson(identifierMeta);
585+
store.Document.Data.ManyValue[0].Meta.Should().BeEquivalentToJson(identifierMeta1);
586+
store.Document.Data.ManyValue[1].Meta.Should().BeEquivalentToJson(identifierMeta2);
581587
}
582588

583589
private sealed class CapturingDocumentAdapter : IDocumentAdapter

0 commit comments

Comments
 (0)