Ejemplo n.º 1
0
            public void Should_assert_subscriptions_of_a_cold_observable()
            {
                var source       = _scheduler.CreateColdObservable <char>("---a---b-|");
                var subs         = "^--------!";
                var unsub        = "---------|";
                var subscription = source.Subscribe();

                _scheduler.ScheduleAbsolute(subscription, _scheduler.CreateTime(unsub), (_, sub) =>
                {
                    sub.Dispose();
                    return(Disposable.Empty);
                });

                _scheduler.ExpectSubscriptions(source.Subscriptions).ToBe(subs);
            }
Ejemplo n.º 2
0
            public void Should_create_a_cold_observable()
            {
                var expected  = new Queue <char>(new[] { 'A', 'B' });
                var scheduler = new MarbleTestScheduler();
                var source    = scheduler.CreateColdObservable <char>("--a---b--|", new { a = 'A', b = 'B' });

                source.Subscribe(x => { Assert.That(x, Is.EqualTo(expected.Dequeue())); });
                scheduler.Flush();
                Assert.That(expected.Count, Is.Zero);
            }
Ejemplo n.º 3
0
 public void Should_fail_when_observables_end_with_different_error_types()
 {
     Assert.Throws <Exception>(() =>
     {
         var scheduler = new MarbleTestScheduler();
         var source    = scheduler.CreateColdObservable <Unit>("---#", null, new ArgumentException());
         scheduler.ExpectObservable(source).ToBe("---#", null, new Exception());
         scheduler.Flush();
     });
 }