예제 #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
 /// <summary>
 /// Creates an array of objects that represent each class that inherits from Primate
 /// </summary>
 /// <returns>Array of classes that inherit from Primate</returns>
 public static Primate[] CreatePrimates()
 {
     Primate[] primates = new Primate[3];
     primates[0] = new Lemur();
     primates[1] = new Chimpanzee();
     primates[2] = new Proboscis();
     return(primates);
 }
예제 #3
0
        public static void IncubatorShouldTakeAFuncAndReturnResult2()
        {
            Incubator i = new Incubator();

            i.Set <Primate>(() => { return(new Monkey()); });
            Primate m = i.Get <Primate>();

            Expect.IsTrue(m.GetType() == typeof(Monkey));
        }
예제 #4
0
        public static void IncubatorShouldGiveMeWhatISet2()
        {
            Incubator i = new Incubator();

            i.Set <Primate>(new Monkey());
            Primate m = i.Get <Primate>();

            Expect.IsTrue(m.GetType() == typeof(Monkey));
        }
예제 #5
0
        public static void IncubatorShouldTakeAFuncAndReturnResult()
        {
            Incubator      i = new Incubator();
            Func <Primate> f = () => new Monkey();

            i.Set(typeof(Primate), f);
            Primate m = i.Get <Primate>();

            (m.GetType() == typeof(Monkey)).IsTrue();
        }
예제 #6
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));
        }
예제 #7
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));
        }
예제 #8
0
 private void Start()
 {
     thisPrimate = GetComponentInParent <Primate>();
 }