public void Run_BingConsumerPresent_BingConsumerGetsConsumed() { var consumerMock = new Mock<IBingConsumer>(); var settings = new BingSearchSettings { Times = 1 }; var app = new Application(settings, consumerMock.Object); app.Run(); consumerMock.Verify(x => x.Consume(It.IsAny<string>()), Times.Once()); }
public void Run_BingConsumer2Times_BingConsumerGetsConsumed2Times() { var consumerMock = new Mock<IBingConsumer>(); var settings = new BingSearchSettings { Times = 2 }; var app = new Application(settings, consumerMock.Object); app.Run(); consumerMock.Verify(x => x.Consume(It.IsAny<string>()), Times.Exactly(2)); }
public void Run_BingConsumerDowntime_ShouldNotThrow() { var consumerMock = new Mock<IBingConsumer>(); var settings = new BingSearchSettings { Times = 1 }; consumerMock.Setup(x => x.Consume(It.IsAny<string>())).Throws<HttpRequestException>(); var app = new Application(settings, consumerMock.Object); Action action = () => app.Run(); action.ShouldNotThrow(); }
public void Run_BingConsumerDowntime2Times_BingConsumerGetsConsumedTwice() { var consumerMock = new Mock<IBingConsumer>(); var settings = new BingSearchSettings { Times = 2 }; consumerMock.Setup(x => x.Consume(It.IsAny<string>())).Throws<HttpRequestException>(); var app = new Application(settings, consumerMock.Object); app.Run(); consumerMock.Verify(x => x.Consume(It.IsAny<string>()), Times.Exactly(2)); }