public async Task When_expect_more_than_one_messages() { var cmd = new InflateCopyCommand(100, Guid.NewGuid().ToString()); _result = await Node.Prepare(cmd) .Expect <BalloonTitleChanged>(e => e.SourceId == cmd.AggregateId) .And <BalloonCreated>(e => e.SourceId == cmd.AggregateId) .Execute(); await Task.Delay(1000); //waiting for logs //Then_recieve_something() Assert.NotNull(_result); //Then_recieve_non_empty_collection() Assert.NotEmpty(_result.All); //Then_recieved_collection_of_expected_messages() Assert.True(_result.Message <BalloonTitleChanged>() != null && _result.Message <BalloonCreated>() != null); //Then_recieve_only_expected_messages() Assert.True(_result.All.Count == 2); }
public async Task When_expect_more_than_one_messages() { var syncCommand = new InflateCopyCommand(100, Guid.NewGuid().ToString()); var waitResults = await Node.Prepare(syncCommand) .Expect <BalloonTitleChanged>() .And <BalloonCreated>() .Execute(); _allReceivedMessages = waitResults.All.ToArray(); //Then_recieve_something() Assert.NotNull(_allReceivedMessages); //Then_recieve_non_empty_collection() Assert.True(_allReceivedMessages.Any()); //Then_recieve_collection_of_expected_messages() Assert.Contains(_allReceivedMessages, m => (m as IMessageMetadataEnvelop)?.Message is BalloonTitleChanged); Assert.Contains(_allReceivedMessages, m => (m as IMessageMetadataEnvelop)?.Message is BalloonCreated); //Then_recieve_only_expected_messages() Assert.True(_allReceivedMessages.Length == 2); }