public void ReactiveSubjectBase_Subscribe() { var s = new MyReactiveSubject <int>(); var iv2 = default(IReactiveObserver <int>); var uri2 = default(Uri); var state2 = default(object); s.SubscribeImpl = (o, u, x) => { iv2 = o; uri2 = u; state2 = x; return(null); }; var iv = new MyObserver <int>(); var uri = new Uri("foo://bar"); var state = "qux"; s.Subscribe(iv, uri, state); Assert.AreSame(iv, iv2); Assert.AreSame(uri, uri2); Assert.AreSame(state, state2); }
public void ReactiveSubjectBase_Subscribe_ArgumentChecking() { var s = new MyReactiveSubject <int>(); var iv = new MyObserver <int>(); var uri = new Uri("foo://bar"); var state = "qux"; Assert.ThrowsException <ArgumentNullException>(() => s.Subscribe(null, uri, state)); Assert.ThrowsException <ArgumentNullException>(() => s.Subscribe(iv, null, state)); }
public void ReactiveSubjectBase_OnCompleted() { var s = new MyReactiveSubject <int>(); var done = false; s.OnCompletedImpl = () => { done = true; }; s.OnCompleted(); Assert.IsTrue(done); }
public void ReactiveSubjectBase_OnNext() { var s = new MyReactiveSubject <int>(); var y = 0; s.OnNextImpl = (x) => { y = x; }; s.OnNext(42); Assert.AreEqual(42, y); }
public void ReactiveSubjectBase_Dispose() { var s = new MyReactiveSubject <int>(); var disposed = false; s.DisposeImpl = () => { disposed = true; }; s.Dispose(); Assert.IsTrue(disposed); }
public void ReactiveSubjectBase_OnError() { var s = new MyReactiveSubject <int>(); var err = default(Exception); s.OnErrorImpl = (e) => { err = e; }; var ex = new Exception(); s.OnError(ex); Assert.AreSame(ex, err); }
public void ReactiveSubjectBase_OnError_ArgumentChecking() { var s = new MyReactiveSubject <int>(); Assert.ThrowsException <ArgumentNullException>(() => s.OnError(null)); }