public void PropertyChangedTest() { TestPage testPage = new TestPage(); string dummyObject = "dummy"; string propertyName = "Property1"; string expectedValue = "Value1"; string newValue = "Value2"; TestIPropertyPageSite site = new TestIPropertyPageSite(); site.page = testPage; testPage.SetPageSite(site); testPage.SetObjects(1, new object[] { dummyObject }); TestIPropertyStore testPropertyStore = testPage.IPropertyStore as TestIPropertyStore; testPropertyStore.Properties.Add(propertyName, expectedValue); testPage.PropertyChanged(propertyName, newValue); Assert.AreEqual((uint)(PROPPAGESTATUS.PROPPAGESTATUS_VALIDATE | PROPPAGESTATUS.PROPPAGESTATUS_DIRTY), site.StatusChangeFlags); Assert.AreEqual(newValue, testPropertyStore.Properties[propertyName]); }
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); }