Beispiel #1
0
 public void ExpectSubscriptions_can_be_called_multiple_times_in_single_test()
 {
     using (var s = new MarbleScheduler())
     {
         s.ExpectSubscriptions(new Subscription(20, 20)).ToBe("--(^!)");
         s.ExpectSubscriptions(new Subscription(0, 0)).ToBe("(^!)");
         s.ExpectSubscriptions(new Subscription(0, 10)).ToBe("^!");
     }
 }
Beispiel #2
0
 public void ExpectSubscriptions_should_work_for_grouped_subscription_and_unsubscription()
 {
     using (var s = new MarbleScheduler())
     {
         s.ExpectSubscriptions(new Subscription(20, 20)).ToBe("--(^!)");
     }
 }
Beispiel #3
0
 public void ExpectSubscriptions_should_work_for_subscription_not_at_zero()
 {
     using (var s = new MarbleScheduler())
     {
         s.ExpectSubscriptions(new Subscription(20)).ToBe("--^");
     }
 }
Beispiel #4
0
 public void ExpectSubscriptions_should_work_for_empty_subscription()
 {
     using (var s = new MarbleScheduler())
     {
         s.ExpectSubscriptions(new Subscription(Subscription.Infinite)).ToBe("");
     }
 }
Beispiel #5
0
 public void Dispose_allows_for_not_calling_start()
 {
     using (var s = new MarbleScheduler())
     {
         s.ExpectSubscriptions(new Subscription()).ToBe("(^!)");
     }
 }
 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);
     }
 }
Beispiel #7
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);
     }
 }
Beispiel #8
0
        public void incorrect_marbles_should_result_in_test_failure()
        {
            Action a = () =>
            {
                using (var s = new MarbleScheduler())
                {
                    s.ExpectSubscriptions(new Subscription(20, 40)).ToBe("^---------!");
                }
            };

            Assert.Throws <ExpectSubscriptionToBeFailedException>(a);
        }
Beispiel #9
0
        public void ExpectSubscriptions_should_throw_on_wrong_markers()
        {
            Action a = () =>
            {
                using (var s = new MarbleScheduler())
                {
                    s.ExpectSubscriptions(new Subscription(20, 20)).ToBe("a-(^!)");
                }
            };

            Assert.Throws <ArgumentException>(a);
        }