public void AspxPagesAreNotAddedToLifetimeContainer() { TestableWebClientApplication application = new TestableWebClientApplication(); MockHttpContext mockContext = new MockHttpContext(); MockPage mockPage = new MockPage(); mockContext.Request = new HttpRequest("page.aspx", "http://application/page.aspx", null); mockContext.Handler = mockPage; mockContext.ApplicationInstance = application; TestableRootCompositionContainer container = new TestableRootCompositionContainer(); application.ModuleContainer = container; application.SetTestCurrentContext(mockContext); application.TestRun(); int lifetimeObjects = container.Locator.Count; //application.TestPreRequestHandlerExecute(mockContext); mockPage.CallOnInit(); Assert.IsNotNull(mockPage.Presenter); Assert.IsNull(container.Locator.Get <MockPresenter>()); Assert.IsNull(container.Locator.Get <MockPage>()); //application.TestPostRequestHandlerExecute(mockContext); Assert.AreEqual(lifetimeObjects, container.Locator.Count); }
public void TestRootContainerCreatedByCreateRootContainer() { TestableWebClientApplication application = new TestableWebClientApplication(); application.TestRun(); Assert.IsTrue(application.RooContainerCreated); Assert.IsNotNull(application.RootContainer); }
public void TestPageBuilderIsCreatedByCreatePageBuilder() { TestableWebClientApplication application = new TestableWebClientApplication(); application.TestRun(); Assert.IsTrue(application.PageBuilderCreated); Assert.IsNotNull(application.PageBuilder); }
public void WebApplicationCreatesBuilderThatDoesContainerAwareTypeMapping() { TestableWebClientApplication app = new TestableWebClientApplication(); MockHttpContext context = new MockHttpContext(); app.TestRun(); CompositionContainer root = app.RootContainer; root.RegisterTypeMapping <IFoo, Foo>(); IFoo created = (IFoo)(root.BuildNewItem(typeof(IFoo))); Assert.IsNotNull(created); Assert.IsTrue(created is Foo); }
public void NestedUserControlsAreBuiltCorrectly() { TestableWebClientApplication application = new TestableWebClientApplication(); MockHttpContext mockContext = new MockHttpContext(); MockPage mockPage = new MockPage(); mockContext.Request = new HttpRequest("page.aspx", "http://application/page.aspx", null); mockContext.Handler = mockPage; mockContext.ApplicationInstance = application; TestableRootCompositionContainer container = new TestableRootCompositionContainer(); application.ModuleContainer = container; application.SetTestCurrentContext(mockContext); application.TestRun(); mockPage.CallOnInit(); mockPage.MyControl.CallOnInit(); mockPage.MyControl.Nested.CallOnInit(); Assert.IsNotNull(mockPage.Presenter); Assert.IsNotNull(mockPage.MyControl.MyControlPresenter); Assert.IsNotNull(mockPage.MyControl.Nested.MyControlPresenter); }
public void TestModulesAreLoadedUsingEnumeratorAndLoaderServices() { TestableWebClientApplication application = new TestableWebClientApplication(); application.TestRun(); }