public void ConnectableObservable_Connected() { var scheduler = new TestScheduler(); var xs = scheduler.CreateHotObservable <int>( OnNext(210, 1), OnNext(220, 2), OnNext(230, 3), OnNext(240, 4), OnCompleted <int>(250) ); var subject = new MySubject(); var conn = new ConnectableObservable <int>(xs, subject); var disconnect = conn.Connect(); var res = scheduler.Start(() => conn); res.Messages.AssertEqual( OnNext(210, 1), OnNext(220, 2), OnNext(230, 3), OnNext(240, 4), OnCompleted <int>(250) ); }
public void ConnectableObservable_Creation() { var y = 0; var s2 = new Subject <int>(); var co2 = new ConnectableObservable <int>(Observable.Return <int>(1), s2); co2.Subscribe(x => y = x); Assert.AreNotEqual(1, y); co2.Connect(); Assert.AreEqual(1, y); }