public void Online_Error_Fused() { var ms = new MonocastSubject <int>(); Assert.False(ms.HasObservers); Assert.False(ms.HasException()); Assert.False(ms.HasCompleted()); Assert.Null(ms.GetException()); var to = ms.Test(fusionMode: FusionSupport.Any); to.AssertFuseable() .AssertFusionMode(FusionSupport.Async); ms.Test().AssertFailure(typeof(InvalidOperationException)); Assert.True(ms.HasObservers); Assert.False(ms.HasException()); Assert.False(ms.HasCompleted()); Assert.Null(ms.GetException()); to.AssertEmpty(); ms.OnNext(1); to.AssertValuesOnly(1); ms.OnNext(2); to.AssertValuesOnly(1, 2); ms.OnNext(3); to.AssertValuesOnly(1, 2, 3); var ex = new IndexOutOfRangeException(); ms.OnError(ex); to.AssertFailure(typeof(IndexOutOfRangeException), 1, 2, 3); Assert.False(ms.HasObservers); Assert.True(ms.HasException()); Assert.False(ms.HasCompleted()); Assert.AreEqual(ex, ms.GetException()); ms.Test().AssertFailure(typeof(InvalidOperationException)); }
public void Offline_Basic_Fused() { var ms = new MonocastSubject <int>(); ms.OnNext(1); ms.OnNext(2); ms.OnNext(3); ms.OnCompleted(); Assert.False(ms.HasObservers); Assert.False(ms.HasException()); Assert.True(ms.HasCompleted()); Assert.Null(ms.GetException()); var to = ms.Test(fusionMode: FusionSupport.Any); to.AssertFuseable() .AssertFusionMode(FusionSupport.Async); Assert.False(ms.HasObservers); to.AssertResult(1, 2, 3); ms.Test().AssertFailure(typeof(InvalidOperationException)); }
public void Online_Basic() { var ms = new MonocastSubject <int>(); Assert.False(ms.HasObservers); Assert.False(ms.HasException()); Assert.False(ms.HasCompleted()); Assert.Null(ms.GetException()); var to = ms.Test(); ms.Test().AssertFailure(typeof(InvalidOperationException)); Assert.True(ms.HasObservers); Assert.False(ms.HasException()); Assert.False(ms.HasCompleted()); Assert.Null(ms.GetException()); to.AssertEmpty(); ms.OnNext(1); to.AssertValuesOnly(1); ms.OnNext(2); to.AssertValuesOnly(1, 2); ms.OnNext(3); to.AssertValuesOnly(1, 2, 3); ms.OnCompleted(); to.AssertResult(1, 2, 3); Assert.False(ms.HasObservers); Assert.False(ms.HasException()); Assert.True(ms.HasCompleted()); Assert.Null(ms.GetException()); ms.Test().AssertFailure(typeof(InvalidOperationException)); }
public void Offline_Error() { var ms = new MonocastSubject <int>(); var ex = new IndexOutOfRangeException(); ms.OnNext(1); ms.OnNext(2); ms.OnNext(3); ms.OnError(ex); Assert.False(ms.HasObservers); Assert.True(ms.HasException()); Assert.False(ms.HasCompleted()); Assert.AreEqual(ex, ms.GetException()); var to = ms.Test(); to.AssertFailure(typeof(IndexOutOfRangeException), 1, 2, 3); Assert.False(ms.HasObservers); ms.Test().AssertFailure(typeof(InvalidOperationException)); }