コード例 #1
0
 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);
 }
コード例 #2
0
 public void TestAllQuestions()
 {
     //KoanUtils.Verify<CurrentLesson>(l => l.LaunchingAnActionInTheFuture(), 0);
     //KoanUtils.Verify<CurrentLesson>(l => l.LaunchingAnEventInTheFuture(), 0);
     KoanUtils.Verify <CurrentLesson>(l => l.YouCanPlaceATimelimitOnHowLongAnEventShouldTake(), 2100);
     KoanUtils.Verify <CurrentLesson>(l => l.Throttling(), "from scott");
     KoanUtils.Verify <CurrentLesson>(l => l.Buffering(), "Scott Reed");
     KoanUtils.Verify <CurrentLesson>(l => l.TimeBetweenCalls(), "slow down");
 }
コード例 #3
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");
        }
コード例 #4
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);
 }
コード例 #5
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);
 }
コード例 #6
0
 public void TestAllQuestions()
 {
     KoanUtils.Verify <CurrentLesson>(l => l.LambdasAreBlocksOfCode(), true);
     KoanUtils.Verify <CurrentLesson>(l => l.LambdasAreActions(), true);
     KoanUtils.Verify <CurrentLesson>(l => l.GettingStarted1ReadingTheErrorMessage(), "Harry Potter");
     KoanUtils.Verify <CurrentLesson>(l => l.LambdasAreNotRunAtDeclaration(), 2);
     KoanUtils.Verify <CurrentLesson>(l => l.ButLambdasMightNotBeCalled(), false);
     KoanUtils.Verify <CurrentLesson>(l => l.LambdasCanUseLocalVariables(), "Awesome!");
     KoanUtils.Verify <CurrentLesson>(l => l.LambdasAreTinyMethods(), "Passed In");
     KoanUtils.Verify <CurrentLesson>(l => l.LambdasCanReturnAValue(), "Bart");
     KoanUtils.Verify <CurrentLesson>(l => l.LambdasThatReturnAreCalledFunctions(), 25);
     KoanUtils.Verify <CurrentLesson>(l => l.LambdasAutomaticallyReturnSingleStatements(), "Llewellyn");
     KoanUtils.Verify <CurrentLesson>(l => l.LambdasCanUseParametersInReturn(), 5);
     KoanUtils.Verify <CurrentLesson>(l => l.LambdasCanBeVeryTerse(), 8);
     KoanUtils.Verify <CurrentLesson>(l => l.LambdasCanBeVeryVerbose(), 'a');
     KoanUtils.Verify <CurrentLesson>(l => l.MethodDuplication1Of2(), "cat");
     KoanUtils.Verify <CurrentLesson>(l => l.MethodDuplication2Of2(), "boat");
     KoanUtils.Verify <CurrentLesson>(l => l.ParameterDuplication1Of2(), "beer");
     KoanUtils.Verify <CurrentLesson>(l => l.ParameterDuplication2Of2(), 99);
     KoanUtils.Verify <CurrentLesson>(l => l.LambdaDuplication1Of2(), 8);
     KoanUtils.Verify <CurrentLesson>(l => l.LambdaDuplication2Of2(), 2);
 }
コード例 #7
0
 public void TestAllQuestions()
 {
     KoanUtils.Verify <CurrentLesson>(l => l.TheMainEvent(), "BAR");
 }
コード例 #8
0
 public void TestAllQuestions()
 {
     KoanUtils.Verify <CurrentLesson>(l => l.Linq(), 11);
     KoanUtils.Verify <CurrentLesson>(l => l.LinqOverMouseEvents(), new Point(75, 75));
 }