public async void ShouldNotAllowToStartAlreadyStartedEngine() { // Given var imageProvider = new Mock <IImageProvider>(); Image image; imageProvider.Setup(ia => ia.TryToObtainImage(out image)).Callback(ImageProviderMockWork).Returns(true); var engine = new SyncProcessingEngine(imageProvider.Object, ImageProcessingChain.Object, ReceiveProcessedImageCommand.Object); // When var task = engine.Start(); // Then Assert.Throws <InvalidEngineStateException>(() => { engine.Start(); }); await engine.Stop(); }
public async void ShouldInformAboutNotWorkingWhenNoThreadRunning() { // Given var imageProvider = new Mock <IImageProvider>(); Image image; imageProvider.Setup(ia => ia.TryToObtainImage(out image)).Callback(ImageProviderMockWork).ReturnsInOrder(true, false); var engine = new SyncProcessingEngine(imageProvider.Object, ImageProcessingChain.Object, ReceiveProcessedImageCommand.Object); // When await engine.Start(); // Then Assert.IsFalse(engine.IsWorking()); }