public void ComponentEditorPage_SetSite_Invoke_SetsPageSite()
        {
            var control     = new Control();
            var controlSite = new Mock <IComponentEditorPageSite>(MockBehavior.Strict);

            controlSite
            .Setup(s => s.GetControl())
            .Returns(control)
            .Verifiable();
            var noControlSite = new Mock <IComponentEditorPageSite>(MockBehavior.Strict);

            noControlSite
            .Setup(s => s.GetControl())
            .Returns <Control>(null)
            .Verifiable();
            var page = new SubComponentEditorPage();

            page.SetSite(controlSite.Object);
            Assert.Same(controlSite.Object, page.PageSite);
            Assert.Same(page, Assert.Single(control.Controls));
            Assert.Equal(0, page.LoadComponentCallCount);
            Assert.Equal(0, page.Loading);
            Assert.False(page.LoadRequired);

            // Set same.
            page.SetSite(controlSite.Object);
            Assert.Same(controlSite.Object, page.PageSite);
            Assert.Same(page, Assert.Single(control.Controls));
            Assert.Equal(0, page.LoadComponentCallCount);
            Assert.Equal(0, page.Loading);
            Assert.False(page.LoadRequired);

            // Set different.
            page.SetSite(noControlSite.Object);
            Assert.Same(noControlSite.Object, page.PageSite);
            Assert.Same(page, Assert.Single(control.Controls));
            Assert.Equal(0, page.LoadComponentCallCount);
            Assert.Equal(0, page.Loading);
            Assert.False(page.LoadRequired);

            // Set null.
            page.SetSite(null);
            Assert.Null(page.PageSite);
            Assert.Same(page, Assert.Single(control.Controls));
            Assert.Equal(0, page.LoadComponentCallCount);
            Assert.Equal(0, page.Loading);
            Assert.False(page.LoadRequired);
        }