public void BeCompletedAfterCompletion() { var denoiser = new DenoisingStream(strategy.Object, new Counter(), CancellationToken.None, logger.Object); denoiser.Complete(); Assert.True(denoiser.Completed); }
public async Task CompleteStreamWhenRequested() { var denoiser = new DenoisingStream(strategy.Object, new Counter(), CancellationToken.None, logger.Object); var observer = new TestImageObserver <Rgb>(); using (denoiser.Subscribe(observer)) { denoiser.Complete(); await Task.Delay(TimeSpan.FromMilliseconds(100)); } Assert.True(observer.StreamCompleted); }
public async Task NotProvideDataForObserversAfterCompletion() { var inputImage = new Image <Rgb, byte>(1, 1); var expectedImage = new Image <Rgb, byte>(10, 10); strategy.Setup(s => s.Denoise(inputImage)).Returns(expectedImage); var denoiser = new DenoisingStream(strategy.Object, new Counter(), CancellationToken.None, logger.Object); var observer = new TestImageObserver <Rgb>(); using (denoiser.Subscribe(observer)) { denoiser.Complete(); denoiser.Process(inputImage); await Task.Delay(TimeSpan.FromMilliseconds(100)); } Assert.Empty(observer.ReceivedItems); }