Exemplo n.º 1
0
        public async Task Send_replays_to_all_buses(
            IMessageBus[] buses, Message[] messages, string partitionKey)
        {
            var sut = new CompositeMessageBus(buses);
            await sut.Send(messages, partitionKey);

            buses.Select(Mock.Get).ForEach(bus => bus.Verify(x => x.Send(messages, partitionKey), Times.Once()));
        }
Exemplo n.º 2
0
        public async Task Send_replays_to_all_buses_even_if_some_fails(
            IMessageBus[] buses, Message[] messages, string partitionKey)
        {
            // Arrange
            Mock.Get(buses.Sample())
            .Setup(x => x.Send(messages, partitionKey))
            .ThrowsAsync(new InvalidOperationException());

            var sut = new CompositeMessageBus(buses);

            // Act
            await TryCatchIgnore(() => sut.Send(messages, partitionKey));

            // Assert
            buses.Select(Mock.Get).ForEach(bus => bus.Verify(x => x.Send(messages, partitionKey), Times.Once()));
        }