public void ShouldNotAllowToStopNotStartedEngine() { // 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 // Then Assert.Throws <InvalidEngineStateException>(async() => await engine.Stop()); }
public async void ShouldInformAboutWorkingWhenThreadRunning() { // 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.IsTrue(engine.IsWorking()); await engine.Stop(); }