Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
  • Loading branch information
Gsantomaggio committed Oct 17, 2023
1 parent 3ed749c commit 906fa39
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Tests/EventBusTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,17 @@ public async Task SendsAndReceivesSuperStreamRawProducerEvents()
var bus = new StreamEventsBus();
bus.Subscribe<RawProducerConnected>(async connected =>
{
_testOutputHelper.WriteLine(
$"raw producer connected {connected.Instance.Info.ClientProvidedName} to stream {connected.Instance.Info.Stream}");
events.Add(connected);
await Task.CompletedTask;
});
bus.Subscribe<RawProducerDisconnected>(async disconnected =>
{
events.Add(disconnected);
_testOutputHelper.WriteLine(
$"raw producer disconnected {disconnected.Instance.Info.ClientProvidedName} from the stream {disconnected.Instance.Info.Stream}. Events: {events.Count}");
if (events.Count == 6)
{
testPassed.SetResult(events);
Expand Down Expand Up @@ -130,9 +135,10 @@ await system.CreateRawSuperStreamProducer(
{
var connected = (RawProducerConnected)events[i];
Assert.Equal(new IPEndPoint(IPAddress.IPv6Loopback, 5552), connected.Parameters.Endpoint);
Assert.Equal("dotnet-stream-raw-producer", connected.Parameters.ClientProvidedName);
Assert.Contains(connected.Instance.Info.Stream, SystemUtils.InvoicesStreams);
Assert.Contains(connected.Instance.Info.ClientProvidedName, $"dotnet-stream-raw-producer#invoices-{i}");
Assert.Equal(typeof(RawProducerConnected), connected.GetType());
Assert.Contains(connected.Instance.Info.ClientProvidedName, $"dotnet-stream-raw-producer#invoices-{i}");
Assert.Equal(EventTypes.Connection, connected.EventType);
Assert.Equal(EventSeverity.Info, connected.EventSeverity);
}
Expand All @@ -141,9 +147,8 @@ await system.CreateRawSuperStreamProducer(
{
var disconnected = (RawProducerDisconnected)events[i];
Assert.Equal(new IPEndPoint(IPAddress.IPv6Loopback, 5552), disconnected.Parameters.Endpoint);
Assert.Equal("dotnet-stream-raw-producer", disconnected.Parameters.ClientProvidedName);
Assert.Contains(disconnected.Instance.Info.Stream, SystemUtils.InvoicesStreams);

Assert.Contains(disconnected.Instance.Info.ClientProvidedName, $"dotnet-stream-raw-producer#invoices-{i}");
Assert.Equal(typeof(RawProducerDisconnected), disconnected.GetType());
Assert.Equal(EventTypes.Disconnection, disconnected.EventType);
Assert.Equal(EventSeverity.Info, disconnected.EventSeverity);
Expand Down

0 comments on commit 906fa39

Please sign in to comment.