public void Markers() { using (var s = new MarbleScheduler()) { var e1 = s.Hot("-a"); var e2 = s.Hot("--b"); var expected = "-ab"; s.ExpectObservable(e1.Merge(e2)).ToBe(expected); } }
public void Ensure() { using (var s = new MarbleScheduler()) { var e1 = s.Hot("----a--^--b-------c--|"); var e2 = s.Hot("---d-^--e---------f-----|"); var expected = "---(be)----c-f-----|"; s.ExpectObservable(e1.Merge(e2)).ToBe(expected); } }
public void ExpectObservable_should_work_for_zipped_observable() { using (var s = new MarbleScheduler()) { var dict = Enumerable.Range(0, 10) .Zip(Enumerable.Range('0' + 0, 10).Select(p => (char)p), Tuple.Create) .ToDictionary(k => k.Item2, v => v.Item1); var e1 = s.Hot("----1--^--2--3-----0--|", dict); var e2 = s.Hot("---2-^--1---2--1----9--|", dict); var expected = "---3---5----1--|"; s.ExpectObservable(e1.Zip(e2, (a, b) => a + b)).ToBe(expected, dict); } }
public void ExpectObservable_should_accept_unsubscription_marble_diagram() { using (var s = new MarbleScheduler()) { var source = s.Hot("---^-a-b-|"); var unsubscribe = "---!"; var expected = "--a"; s.ExpectObservable(source, unsubscribe).ToBe(expected); } }
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_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); } }