コード例 #1
0
 public void ObserveNotifications_ShouldNoBeSubject(SynchronizeFilesWhenFileChanged sut)
 {
     (sut.ObserveNotifications() as ISubject<IFileNotification[]>).Should().BeNull("IObservable<T> is also a ISubject<T>, but it should not");
 }
コード例 #2
0
 public void ObserveFileNotifications_Start_WhenFileNotificationIsYield_ShouldCallSynchronize(
 [Frozen]TestScheduler scheduler,
 [Frozen(As = typeof(IObservable<MusicMirrorConfiguration>))]TestObservableWrapper<MusicMirrorConfiguration> configurationObservable,
 [Frozen]Mock<IFileObserverFactory> fileObserverFactory,
 SynchronizeFilesWhenFileChanged sut,
 MusicMirrorConfiguration configuration,
 IFileNotification[][] fileNotification)
 {
     //arrange
     configurationObservable.SetObservable(scheduler.CreateHotObservable(OnNext(Subscribed + 1, configuration)));
     var expectedNotifications = fileNotification.Select((f, i) => OnNext(Subscribed + i + 2, f)).ToArray();
     var fileObserver = scheduler.CreateHotObservable(expectedNotifications);
     fileObserverFactory.Setup(f => f.GetFileObserver(configuration.SourcePath)).Returns(fileObserver);
     scheduler.Schedule(200.Ticks(), () => sut.Start());
     //act            
     var actual = scheduler.Start(() => sut.ObserveNotifications());
     //assert            
     var expected = expectedNotifications.Select(n => n.Value.Value);
     actual.Values().ShouldAllBeEquivalentTo(expected);
 }