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); }
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); }
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); }
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); }