|
3 | 3 | // Copyright (c) 2017-2023 Broadcom. All Rights Reserved. The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
4 | 4 |
|
5 | 5 | using System;
|
| 6 | +using System.Collections.Generic; |
6 | 7 | using System.Text;
|
7 | 8 | using System.Threading;
|
8 | 9 | using System.Threading.Tasks;
|
@@ -80,16 +81,22 @@ public async Task DeduplicationInActionSendingTheSameIdMessagesWontStore()
|
80 | 81 | SystemUtils.InitStreamSystemWithRandomStream(out var system, out var stream);
|
81 | 82 | var testPassed = new TaskCompletionSource<ulong>();
|
82 | 83 | const ulong TotalMessages = 1000UL;
|
83 |
| - var p = await DeduplicatingProducer.Create( |
84 |
| - new DeduplicatingProducerConfig(system, stream, "my_producer_reference") |
| 84 | + var dupConfig = new DeduplicatingProducerConfig(system, stream, "my_producer_reference") |
| 85 | + { |
| 86 | + ConfirmationHandler = async confirmation => |
85 | 87 | {
|
86 |
| - ConfirmationHandler = async confirmation => |
87 |
| - { |
88 |
| - if (confirmation.PublishingId == TotalMessages) |
89 |
| - testPassed.SetResult(TotalMessages); |
90 |
| - await Task.CompletedTask; |
91 |
| - }, |
92 |
| - }); |
| 88 | + if (confirmation.PublishingId == TotalMessages) |
| 89 | + testPassed.SetResult(TotalMessages); |
| 90 | + await Task.CompletedTask; |
| 91 | + }, |
| 92 | + }; |
| 93 | + var statusInfoReceived = new List<StatusInfo>(); |
| 94 | + dupConfig.StatusChanged += (status) => { statusInfoReceived.Add(status); }; |
| 95 | + |
| 96 | + var p = await DeduplicatingProducer.Create(dupConfig); |
| 97 | + |
| 98 | + Assert.Equal(ReliableEntityStatus.Initialization, statusInfoReceived[0].From); |
| 99 | + Assert.Equal(ReliableEntityStatus.Open, statusInfoReceived[0].To); |
93 | 100 | // first send and the messages are stored
|
94 | 101 | for (ulong i = 1; i <= TotalMessages; i++)
|
95 | 102 | {
|
|
0 commit comments