public static void FluentIncubatorTest() { Incubator i = Requesting.A <Primate>().Returns <Monkey>(); Primate m = i.Get <Primate>(); Expect.IsTrue(m.GetType() == typeof(Monkey)); }
/// <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); }
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)); }
public static void IncubatorShouldGiveMeWhatISet2() { Incubator i = new Incubator(); i.Set <Primate>(new Monkey()); Primate m = i.Get <Primate>(); Expect.IsTrue(m.GetType() == typeof(Monkey)); }
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(); }
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)); }
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)); }
private void Start() { thisPrimate = GetComponentInParent <Primate>(); }