public void TestAllQuestions()
 {
     KoanUtils.Verify <CurrentLesson>(l => l.SimpleSubscription(), 42);
     KoanUtils.Verify <CurrentLesson>(l => l.WhatGoesInComesOut(), 101);
     KoanUtils.Verify <CurrentLesson>(l => l.ThisIsTheSameAsAnEventStream(), 37);
     KoanUtils.AssertLesson <CurrentLesson>(l => l.HowEventStreamsRelateToObservables(),
                                            l =>
                                            StringUtils.call =
                                                (s, p) => { ((Subject <int>)s).OnNext(((int)p[0])); return(0); });
     KoanUtils.Verify <CurrentLesson>(l => l.EventStreamsHaveMultipleEvents(), 17);
     KoanUtils.Verify <CurrentLesson>(l => l.SimpleReturn(), "Foo");
     KoanUtils.Verify <CurrentLesson>(l => l.TheLastEvent(), "Bar");
     KoanUtils.Verify <CurrentLesson>(l => l.EveryThingCounts(), 7);
     KoanUtils.Verify <CurrentLesson>(l => l.ThisIsStillAnEventStream(), 15);
     KoanUtils.Verify <CurrentLesson>(l => l.AllEventsWillBeRecieved(), "Working 98765");
     KoanUtils.Verify <CurrentLesson>(l => l.DoingInTheMiddle(), "Party");
     KoanUtils.AssertLesson <CurrentLesson>(l => l.NothingListensUntilYouSubscribe(),
                                            l =>
                                            StringUtils.call =
                                                (s, p) => ObservableExtensions.Subscribe((IObservable <int>)s));
     KoanUtils.Verify <CurrentLesson>(l => l.EventsBeforeYouSubscribedDoNotCount(), 7);
     KoanUtils.Verify <CurrentLesson>(l => l.EventsAfterYouUnsubscribDoNotCount(), 3);
     KoanUtils.Verify <CurrentLesson>(l => l.EventsWhileSubscribing(), "you look pretty");
     KoanUtils.AssertLesson <CurrentLesson>(l => l.UnsubscribeAtAnyTime(),
                                            l =>
                                            StringUtils.call =
                                                (s, p) =>
     {
         ((IDisposable)s).Dispose();
         return(1);
     });
     KoanUtils.Verify <CurrentLesson>(l => l.TakeUntilFull(), 5);
 }
Exemplo n.º 2
0
        public void TestAllQuestions()
        {
            Action <Lesson7AsyncInvoke> action = l => { l.____ = "C"; l._____ = "A"; l.______ = "B"; };

            KoanUtils.AssertLesson <Lesson7AsyncInvoke>(l => l.TheBloodyHardAsyncInvokationPatter(), action);
            KoanUtils.Verify <CurrentLesson>(l => l.NiceAndEasyFromAsyncPattern(), 48);
            // Note: I don't know how to properly test AsynchronousRuntimeIsNotSummed
            KoanUtils.Verify <CurrentLesson>(l => l.TimeoutMeansStopListeningDoesNotMeanAbort(), "Give me 5, Joe");
            KoanUtils.Verify <CurrentLesson>(l => l.AsynchronousObjectsAreProperlyDisposed(), "D");
        }
Exemplo n.º 3
0
 public void TestAllQuestions()
 {
     KoanUtils.Verify <CurrentLesson>(l => l.ComposableAddition(), 1000);
     KoanUtils.Verify <CurrentLesson>(l => l.ComposableBeforeAndAfter(), "123456");
     KoanUtils.Verify <CurrentLesson>(l => l.WeWroteThis(), 4);
     KoanUtils.AssertLesson <CurrentLesson>(l => l.ConvertingEvents(),
                                            l => StringUtils.call = (s, p) => ((String)s).ToLower());
     KoanUtils.Verify <CurrentLesson>(l => l.CreatingAMoreRelevantEventStream(), 50);
     KoanUtils.AssertLesson((Action <CurrentLesson>)(l => l.CheckingEverything()), l1 => l1.____ = true);
     KoanUtils.Verify <CurrentLesson>(l => l.CompositionMeansTheSumIsGreaterThanTheParts(), 8);
 }
Exemplo n.º 4
0
 public void TestAllQuestions()
 {
     KoanUtils.Verify <CurrentLesson>(l => l.Merging(), "1 A 2 B 3 C ");
     KoanUtils.Verify <CurrentLesson>(l => l.SplittingUp(), 2);
     KoanUtils.Verify <CurrentLesson>(l => l.MergingEvents(), "I am perfect.");
     KoanUtils.AssertLesson <CurrentLesson>(l => l.NeedToSubscribeImediatelyWhenSplitting(),
                                            l =>
                                            StringUtils.call =
                                                (s, p) =>
                                                ObservableExtensions.Subscribe((IObservable <double>)s, (Action <double>)p[0]));
     KoanUtils.Verify <CurrentLesson>(l => l.MultipleSubscriptions(), 2.0);
 }