コード例 #1
0
        public void Should_create_a_cold_observable()
        {
            var expected = new [] { "A", "B" };
            var source   = _scheduler.CreateColdObservable <string>("--a---b--|", new { a = "A", b = "B" });
            var i        = 0;

            source.Subscribe(x => Check.That(x).IsEqualTo(expected[i++]));
            _scheduler.Start();
            Check.That(i).IsEqualTo(2);
        }
コード例 #2
0
ファイル: StartTests.cs プロジェクト: pmbanka/rx-test-marbles
        public void Start_can_be_called_at_most_once()
        {
            Action a = () =>
            {
                var s = new MarbleScheduler();
                s.Start();
                s.Start();
            };

            Assert.Throws <InvalidOperationException>(a);
        }
コード例 #3
0
ファイル: StartTests.cs プロジェクト: pmbanka/rx-test-marbles
 public void Dispose_can_be_called_even_if_start_was_called()
 {
     using (var s = new MarbleScheduler())
     {
         s.Start();
     }
 }
コード例 #4
0
        public void ExpectObservable_should_materialize_inner_observables()
        {
            var s = new MarbleScheduler();

            var x1 = s.Cold("---a---b---|");
            var x2 = s.Cold("---a---b---|");
            var y  = s.Hot("---x---", Dict.Map('x', x1));

            s.ExpectObservable(y).ToBe("---x---", Dict.Map('x', x2), comparer: new ObservableEqualityComparer <char>());

            s.Start();
        }
コード例 #5
0
        public void Should_create_a_hot_observable()
        {
            var scheduler = new MarbleScheduler();
            var expected  = new[] { "A", "B" };
            var source    = scheduler.CreateHotObservable <string>("--a---b--|", new { a = "A", b = "B" });
            var i         = 0;

            source.Subscribe(x => Check.That(x).IsEqualTo(expected[i++]));
            scheduler.Start();

            Check.That(i).IsEqualTo(2);
            scheduler.Flush();
        }