public void ExpectObservable_should_support_testing_metastreams()
 {
     using (var s = new MarbleScheduler())
     {
         var x            = s.Cold("-a-b|");
         var y            = s.Cold("-c-d|");
         var myObservable = s.Hot("---x---y----|", Dict.Map('x', x, 'y', y));
         var expected     = "---x---y----|";
         s.ExpectObservable(myObservable).ToBe(expected, Dict.Map('x', x, 'y', y));
     }
 }
        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();
        }
 public void ExpectObservable_should_work_for_combine_latest_observable()
 {
     using (var s = new MarbleScheduler())
     {
         var e1       = s.Cold("---a--b----|");
         var e2       = s.Cold("--c----d----|");
         var expected = "---x--yz----|";
         var dict     = new Dictionary <char, string>
         {
             { 'x', "ac" },
             { 'y', "bc" },
             { 'z', "bd" }
         };
         s.ExpectObservable(e1.CombineLatest(e2, (a, b) => a.ToString() + b.ToString()))
         .ToBe(expected, dict);
     }
 }
 public void ExpectObservable_should_handle_inner_observables()
 {
     using (var s = new MarbleScheduler())
     {
         var x                = s.Cold("--a--b--c--d--e--|           ");
         var xsubs            = "         ^         !                  ";
         var y                = s.Cold("---f---g---h---i--|");
         var ysubs            = "                   ^                 !";
         var e1               = s.Hot("---------x---------y---------|        ");
         var e1subs           = "^                            !        ";
         var expected         = "-----------a--b--c----f---g---h---i--|";
         var observableLookup = Dict.Map('x', x, 'y', y);
         var result           = e1.Select(p => observableLookup[p]).Switch();
         s.ExpectObservable(result).ToBe(expected);
         s.ExpectSubscriptions(x.Subscriptions).ToBe(xsubs);
         s.ExpectSubscriptions(y.Subscriptions).ToBe(ysubs);
         s.ExpectSubscriptions(e1.Subscriptions).ToBe(e1subs);
     }
 }
Example #5
0
 public void FactMethodName()
 {
     using (var s = new MarbleScheduler())
     {
         var source = s.Cold("---a---b-|");
         var subs   = "^--!";
         var d      = source.Subscribe();
         s.ScheduleAbsolute(30, () => d.Dispose());
         s.ExpectSubscriptions(source.Subscriptions).ToBe(subs);
     }
 }