Пример #1
0
        public static void FluentIncubatorTest()
        {
            Incubator i = Requesting.A <Primate>().Returns <Monkey>();
            Primate   m = i.Get <Primate>();

            Expect.IsTrue(m.GetType() == typeof(Monkey));
        }
Пример #2
0
 protected bool OnRequesting(HttpRequest request, HttpResponse response)
 {
     if (Requesting != null)
     {
         EventRequestingArgs e = new EventRequestingArgs(request, response);
         e.Cancel = false;
         Requesting?.Invoke(this, e);
         return(!e.Cancel);
     }
     return(true);
 }
Пример #3
0
        public static void FluentConstructorTests3()
        {
            Incubator withApple = Requesting.A <IFruit>().Returns <Apple>();

            withApple.Bind <Monkey>().To <Gorilla>();
            Primate p = withApple.Get <Monkey>();

            Expect.IsTrue(p is Gorilla);
            Gorilla g = (Gorilla)p;

            Expect.IsTrue(g.Fruit.GetType() == typeof(Apple));
        }
Пример #4
0
        public static void FluentConstructorTests()
        {
            Incubator withBanana = Requesting.A <IFruit>().Returns <Banana>();

            withBanana.AskingFor <Primate>().Returns <Gorilla>();
            Primate p = withBanana.Get <Primate>();

            Expect.IsTrue(p is Gorilla);
            Gorilla g = (Gorilla)p;

            Expect.IsTrue(g.Fruit.GetType() == typeof(Banana));
        }