public void DeactivateTest() { TestPage testPage = new TestPage(); TestIPropertyPageSite testSite = new TestIPropertyPageSite(); testPage.SetPageSite(testSite); Mocks.TestHostingForm hostingForm = new PropertyPageBaseTest.Mocks.TestHostingForm(); using (hostingForm) { hostingForm.CreateControl(); RECT hostingRectangle; hostingRectangle.left = 0; hostingRectangle.top = 0; hostingRectangle.right = 100; hostingRectangle.bottom = 100; testPage.Activate(hostingForm.Handle, new RECT[] { hostingRectangle } , 0); TestIPageView pageView = testPage.MyPageView as TestIPageView; Assert.AreEqual(hostingForm, pageView.MyParent); testPage.Deactivate(); Assert.IsNull(pageView.MyParent); } }