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