public void Handler_Crash() { var up = new UnicastSubject <int>(); var ts = up .DoAfterNext(v => { throw new InvalidOperationException(); }) .Test(); up.EmitAll(1, 2, 3, 4, 5); ts.AssertFailure(typeof(InvalidOperationException), 1); Assert.False(up.HasObserver()); }
public void Basic_Alternative() { var list = new List <int>(); var up = new UnicastSubject <int>(); var ts = up .DoAfterNext(v => { list.Add(-v); }) .Do(v => { list.Add(v); }) .Test(); up.EmitAll(1, 2, 3, 4, 5); ts.AssertResult(1, 2, 3, 4, 5); Assert.AreEqual(new List <int>() { 1, -1, 2, -2, 3, -3, 4, -4, 5, -5 }, list); }