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

            string dummyObject = "dummy";

            testPage.SetObjects(1, new object[] { dummyObject });
            TestIPropertyStore testPropertyStore = testPage.IPropertyStore as TestIPropertyStore;
            Assert.AreEqual(dummyObject, testPropertyStore.ObjectSet);
        }
Ejemplo n.º 2
0
        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]);
        }
Ejemplo n.º 3
0
        public void MultipleSetObjectsCallsTest()
        {
            TestPage testPage = new TestPage();

            string dummyObject = "dummy";
            string dummyObject2 = "dummy2";

            testPage.SetObjects(1, new object[] { dummyObject });
            TestIPropertyStore testPropertyStore = testPage.IPropertyStore as TestIPropertyStore;
            Assert.AreEqual(dummyObject, testPropertyStore.ObjectSet);
            testPage.SetObjects(1, new object[] { dummyObject2 });

            testPropertyStore = testPage.IPropertyStore as TestIPropertyStore;
            Assert.AreEqual(dummyObject2, testPropertyStore.ObjectSet);
            Assert.IsTrue((testPage.MyPageView as TestIPageView).PropertiesRefreshed);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
        public void GetValueForPropertyTest()
        {
            TestPage testPage = new TestPage();

            string dummyObject = "dummy";
            string propertyName = "Property1";
            string expectedValue = "Value1";

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

            string actualValue = testPage.GetValueForProperty(propertyName);
            Assert.AreEqual(expectedValue, actualValue);
        }
Ejemplo n.º 6
0
        public void GetPropertyStoreTest()
        {
            TestPage testPage = new TestPage();
            testPage.GetRealStore = true;

            string propertyName = "Property1";
            string propertyValue = "Value1";

            TestIVsBrowseObject dataObject = new TestIVsBrowseObject();
            TestIVsHierarchy hierarchy = new TestIVsHierarchy();
            dataObject.Hierarchy = hierarchy;
            TestDTEProject dteProject = new TestDTEProject();
            hierarchy.dteProject = dteProject;
            TestDTEProperties dteProjectProperties = new TestDTEProperties();
            dteProject.ProjectProperties = dteProjectProperties;
            TestDTEProperty property1 = new TestDTEProperty();
            property1.PropertyValue = propertyValue;
            dteProjectProperties.Properties.Add(propertyName, property1);

            testPage.SetObjects(1, new object[] { dataObject });
            Assert.AreEqual(propertyValue, testPage.GetValueForProperty(propertyName));
        }