public void Error_Delayed() { var us1 = new MonocastSubject <int>(); var us2 = new MonocastSubject <int>(); var to = ObservableSource.Zip(a => { int s = 0; foreach (var v in a) { s += v; } return(s); }, true, us1, us2 ).Test(); us1.EmitError(new InvalidOperationException(), 1, 2, 3); Assert.True(us2.HasObserver(), "us2: No observers!"); us2.Emit(10, 20, 30, 40); Assert.False(us2.HasObserver(), "us2: Observers present!"); to.AssertFailure(typeof(InvalidOperationException), 11, 22, 33); }
public void Basic_With_Error() { var up = new MonocastSubject <int>(); var to = new TestObserver <int>(); up.Subscribe(ObservableSource.ToSerialized(to)); up.EmitError(new InvalidOperationException(), 1, 2, 3, 4, 5); to.AssertFailure(typeof(InvalidOperationException), 1, 2, 3, 4, 5); }
public void Async_Regular_Error() { for (int i = 0; i < 4; i++) { var ms = new MonocastSubject <int>(); ms.EmitError(new InvalidOperationException()); ms .ObserveOn(reactive_extensions.ImmediateScheduler.INSTANCE, delayError: i / 2 == 0, fair: i % 2 == 0) .Test() .WithTag($"delayError={i / 2}, fair={i % 2}") .AssertFailure(typeof(InvalidOperationException)); } }