public void Bug_1283() { var scheduler = new TestScheduler(); var xs = scheduler.CreateHotObservable( OnNext(100, 1), OnNext(220, 2), OnNext(240, 3), OnNext(300, 4), OnNext(310, 5), OnCompleted<int>(350) ); var results = scheduler.Run(() => xs.BufferWithTime(TimeSpan.FromTicks(100), scheduler).Select(ys => string.Join(" ", ys.Select(y => y.ToString()).ToArray()))); results.AssertEqual( OnNext(300, "2 3 4"), OnNext(350, "5"), OnCompleted<string>(350) ); }
public void Bug_1261() { var scheduler = new TestScheduler(); var xs = scheduler.CreateHotObservable( OnNext(205, 1), OnNext(210, 2), OnNext(215, 3), OnNext(220, 4), OnNext(225, 5), OnNext(230, 6), OnCompleted<int>(230)); var results = scheduler.Run(() => xs.BufferWithTime(TimeSpan.FromTicks(10), scheduler).Select(ys => string.Join(" ", ys.Select(y => y.ToString()).ToArray()))); results.AssertEqual( OnNext(210, "1 2"), OnNext(220, "3 4"), OnNext(230, "5 6"), OnCompleted<string>(230) ); }
public void Bug_1302_RightLast_NoRight() { var scheduler = new TestScheduler(); var xs = scheduler.CreateHotObservable( OnNext(215, 2), OnCompleted<int>(217) ); var ys = scheduler.CreateHotObservable( OnCompleted<int>(220) ); var results = scheduler.Run(() => xs.ForkJoin<int, int, int>(ys, (x, y) => x + y)); results.AssertEqual( OnCompleted<int>(220) ); xs.Subscriptions.AssertEqual( Subscribe(200, 217) ); ys.Subscriptions.AssertEqual( Subscribe(200, 220) ); }
public void Bug_1302_SelectorThrows_RightLast() { var scheduler = new TestScheduler(); var xs = scheduler.CreateHotObservable( OnNext(210, 1), OnCompleted<int>(217) ); var ys = scheduler.CreateHotObservable( OnNext(215, 2), OnCompleted<int>(220) ); var results = scheduler.Run(() => xs.ForkJoin<int, int, int>(ys, (x, y) => { throw new MockException(1); })); results.AssertEqual( OnError<int>(220, new MockException(1)) ); xs.Subscriptions.AssertEqual( Subscribe(200, 217) ); ys.Subscriptions.AssertEqual( Subscribe(200, 220) ); }
public void Bug_1381() { var scheduler = new TestScheduler(); var xs = scheduler.CreateHotObservable( OnNext( 90, 1), OnNext(110, 2), OnNext(250, 3), OnNext(270, 4), OnNext(280, 5), OnNext(301, 6), OnNext(302, 7), OnNext(400, 8), OnNext(401, 9), OnNext(510, 10) ); var results = new MockObserver<int>(scheduler); var ys = default(IConnectableObservable<int>); var connection = default(IDisposable); var subscription = default(IDisposable); scheduler.Schedule(() => ys = xs.Replay(scheduler), 100); scheduler.Schedule(() => connection = ys.Connect(), 200); scheduler.Schedule(() => subscription = ys.Subscribe(results), 300); scheduler.Schedule(() => subscription.Dispose(), 500); scheduler.Schedule(() => connection.Dispose(), 600); scheduler.Run(); results.AssertEqual( OnNext(301, 3), OnNext(302, 4), OnNext(303, 5), OnNext(304, 6), OnNext(305, 7), OnNext(400, 8), OnNext(401, 9) ); xs.Subscriptions.AssertEqual( Subscribe(200, 600) ); }
public void Bug_1304_Error() { var scheduler = new TestScheduler(); var t = 0L; var xs = scheduler.CreateHotObservable( OnError<int>(300, new MockException(1)) ); var results = scheduler.Run(() => xs.Finally(() => { scheduler.Sleep(TimeSpan.FromTicks(100)); t = scheduler.Ticks; })); results.AssertEqual( OnError<int>(300, new MockException(1)) ); xs.Subscriptions.AssertEqual( Subscribe(200, 300) ); Assert.AreEqual(400, t); }
public void Bug_1380() { var scheduler = new TestScheduler(); var xs = scheduler.CreateHotObservable( OnNext(220, 1), OnNext(250, 2), OnNext(270, 3), OnNext(290, 4), OnNext(310, 5), OnNext(340, 6), OnNext(360, 7), OnError<int>(380, new MockException(1)) ); var results = scheduler.Run(() => xs.Delay(TimeSpan.FromTicks(100), scheduler)); results.AssertEqual( OnNext(320, 1), OnNext(350, 2), OnNext(370, 3), OnError<int>(380, new MockException(1)) ); xs.Subscriptions.AssertEqual( Subscribe(200, 380) ); }
public void Bug_1295_Error() { var scheduler = new TestScheduler(); var xs = scheduler.CreateHotObservable( OnNext(300, 1), OnNext(350, 2), OnNext(500, 3), OnError<int>(550, new MockException(1)) ); var results = scheduler.Run(() => xs.Throttle(TimeSpan.FromTicks(100), scheduler)); results.AssertEqual( OnNext(450, 2), OnError<int>(550, new MockException(1)) ); xs.Subscriptions.AssertEqual( Subscribe(200, 550) ); }