| 123456789101112131415161718192021222324252627 |
- using Admin.NET.Plugin.AiDOP.DataPlatform.Core;
- using Xunit;
- namespace Admin.NET.Plugin.AiDOP.Tests.DataPlatform;
- public sealed class MdpHandoffReceiptTests
- {
- [Fact]
- public void EachDeliveredRowMustBeAccountedForExactlyOnce()
- {
- var batch = Guid.NewGuid();
- var first = Guid.NewGuid();
- var second = Guid.NewGuid();
- var events = new HashSet<Guid> { first, second };
- var conflict = new PurchaseQuarantine(first, "businessKey", "TARGET_ORDER_CONFLICT");
- var partial = new PurchaseHandoffReceipt(batch, 1, [conflict]);
- Assert.True(partial.Matches(batch, events));
- Assert.True((partial with { AcceptedCount = 2, Conflicts = [] }).Matches(batch, events));
- Assert.True((partial with { AcceptedCount = 0, Conflicts = [conflict, conflict with { RawEventId = second }] }).Matches(batch, events));
- Assert.False(partial.Matches(Guid.NewGuid(), events));
- Assert.False((partial with { AcceptedCount = 2 }).Matches(batch, events));
- Assert.False((partial with { AcceptedCount = -1 }).Matches(batch, events));
- Assert.False((partial with { AcceptedCount = 0, Conflicts = [conflict, conflict] }).Matches(batch, events));
- Assert.False((partial with { Conflicts = [conflict with { RawEventId = Guid.NewGuid() }] }).Matches(batch, events));
- }
- }
|