public static void FluentConstructorTests2() { Incubator withApple = Requesting.A <IFruit>().Returns <Apple>(); withApple.AskingFor <Monkey>().Returns <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)); }