コード例 #1
0
        public void PageIsBuiltUpOnPreInit()
        {
            MockWebClientApplication application = new MockWebClientApplication();
            MockHttpContext mockContext = new MockHttpContext();
            mockContext.Request = new HttpRequest("page.aspx", "http://application/page.aspx", null);
            mockContext.ApplicationInstance = application;
            application.SetTestCurrentContext(mockContext);
            MockPage page = new MockPage();

            Assert.IsFalse(page.OnBuiltUpCalled);

            page.FireOnPreInit();

            Assert.IsTrue(page.OnBuiltUpCalled);
        }
コード例 #2
0
        public void MasterPageIsBuiltUpOnInit()
        {
            MockWebClientApplication application = new MockWebClientApplication();
            MockHttpContext          mockContext = new MockHttpContext();

            mockContext.Request             = new HttpRequest("page.aspx", "http://application/page.aspx", null);
            mockContext.ApplicationInstance = application;
            application.SetTestCurrentContext(mockContext);
            MockMasterPage master = new MockMasterPage();

            Assert.IsFalse(master.OnBuiltUpCalled);

            master.FireOnInit();

            Assert.IsTrue(master.OnBuiltUpCalled);
        }
コード例 #3
0
        public void UserControlIsBuiltUpOnInit()
        {
            MockWebClientApplication application = new MockWebClientApplication();
            MockHttpContext          mockContext = new MockHttpContext();

            mockContext.Request             = new HttpRequest("page.aspx", "http://application/page.aspx", null);
            mockContext.ApplicationInstance = application;
            application.SetTestCurrentContext(mockContext);
            System.Web.UI.Page page = new System.Web.UI.Page();
            MockUserControl    uc   = (MockUserControl)page.LoadControl(typeof(MockUserControl), null);

            page.Controls.Add(uc);

            Assert.IsFalse(uc.OnBuiltUpCalled);

            uc.FireOnInit();

            Assert.IsTrue(uc.OnBuiltUpCalled);
        }
コード例 #4
0
        public void UserControlIsBuiltUpOnInit()
        {
            MockWebClientApplication application = new MockWebClientApplication();
            MockHttpContext mockContext = new MockHttpContext();
            mockContext.Request = new HttpRequest("page.aspx", "http://application/page.aspx", null);
            mockContext.ApplicationInstance = application;
            application.SetTestCurrentContext(mockContext);
            System.Web.UI.Page page = new System.Web.UI.Page();
            MockUserControl uc = (MockUserControl) page.LoadControl(typeof (MockUserControl), null);
            page.Controls.Add(uc);

            Assert.IsFalse(uc.OnBuiltUpCalled);

            uc.FireOnInit();

            Assert.IsTrue(uc.OnBuiltUpCalled);
        }