public async Task MailNotificationsServiceShouldReceiveEventProducedByTicketsService() { await TicketsApi.ResetProcessedCommandsCounter(_client); await MailNotificationsApi.ResetReceivedEvents(_client); await MailNotificationsApi.ResetUniqueReceivedEvents(_client); await TicketsApi.PostRandomOrder(_client); await Task.Delay(WaitTimeInterval); await ValidateEventHandling(); }
private async Task ValidateEventHandling(int requests = 1) { var processedCommands = await TicketsApi.GetProcessedCommands(_client); var uniqueReceivedEvents = await MailNotificationsApi.GetUniqueReceivedEvents(_client); var receivedEvents = await MailNotificationsApi.GetReceivedEvents(_client); _testOutputHelper.WriteLine($"TicketsApi: processed commands: {processedCommands}"); _testOutputHelper.WriteLine($"MailNotificationsApi: unique received events: {uniqueReceivedEvents}"); _testOutputHelper.WriteLine($"MailNotificationsApi: received events: {receivedEvents}"); Assert.Equal(requests, processedCommands); Assert.Equal(uniqueReceivedEvents, processedCommands); Assert.True(receivedEvents >= processedCommands); }
public async Task MailNotificationsServiceShouldReceiveAllEventsProducedByTicketsService() { await TicketsApi.ResetProcessedCommandsCounter(_client); await MailNotificationsApi.ResetReceivedEvents(_client); await MailNotificationsApi.ResetUniqueReceivedEvents(_client); const int requests = 10000; for (var i = 1; i <= requests; ++i) { await TicketsApi.PostRandomOrder(_client); } await Task.Delay(WaitTimeInterval); await ValidateEventHandling(requests); }