Ejemplo n.º 1
0
        public void IsPageDirtyTest()
        {
            TestPage testPage = new TestPage();

            TestIPropertyPageSite site = new TestIPropertyPageSite();
            site.ImmediateApply = false;
            site.page = testPage;

            string propertyName = "PropertyName";
            string propertyValue = "PropertyValue";
            string newValue = "PropertyValueNew";
            string dummyObject = "DummyObject";

            testPage.SetPageSite(site);
            testPage.SetObjects(1, new object[] { dummyObject });
            TestIPropertyStore testPropertyStore = testPage.IPropertyStore as TestIPropertyStore;
            testPropertyStore.Properties.Add(propertyName, propertyValue);

            bool actual = testPage.IsPageDirty() == VSConstants.S_OK;
            Assert.AreEqual(false, actual);

            testPage.PropertyChanged(propertyName, newValue);
            actual = testPage.IsPageDirty() == VSConstants.S_OK;
            Assert.AreEqual(true, actual);

            testPage.Apply();
            actual = testPage.IsPageDirty() == VSConstants.S_OK;
            Assert.AreEqual(false, actual);
        }