コード例 #1
0
        public void Initialize()
        {
            TestIPageViewSite pageViewSite = new TestIPageViewSite();
            TestIPropertyPageUI testPageUI = new TestIPropertyPageUI();
            PropertyControlTable propertyControlTable = new PropertyControlTable();

            string property1Name = "Property1";
            string property1ControlName = "TextBox1";
            string property1Value = "Value1";

            string property2Name = "Property2";
            string property2ControlName = "CheckBox1";
            string property2Value = "true";

            pageViewSite.PropertyNameValueDictionary.Add(property1Name, property1Value);
            pageViewSite.PropertyNameValueDictionary.Add(property2Name, property2Value);

            propertyControlTable.Add(property1Name, property1ControlName);
            propertyControlTable.Add(property2Name, property2ControlName);

            testPageUI.controlValues.Add(property1ControlName, "NotSet");
            testPageUI.controlValues.Add(property2ControlName, "NotSet");

            PropertyControlMap map = new PropertyControlMap(pageViewSite, testPageUI, propertyControlTable);

            map.InitializeControls();
            Assert.AreEqual(2, pageViewSite.RequestedProperties.Count);
            Assert.IsTrue(pageViewSite.RequestedProperties.Contains(property1Name));
            Assert.IsTrue(pageViewSite.RequestedProperties.Contains(property2Name));
            Assert.AreEqual(property1Value, testPageUI.controlValues[property1ControlName]);
            Assert.AreEqual(property2Value, testPageUI.controlValues[property2ControlName]);
            Assert.AreEqual(map, testPageUI.registeringMap);
        }
コード例 #2
0
        public void AddTest()
        {
            PropertyControlTable testTable = new PropertyControlTable();

            testTable.Add(expectedPropertyName, expectedControlName);
            Assert.AreEqual(expectedControlName, testTable.GetControlNameFromPropertyName(expectedPropertyName));
            Assert.AreEqual(expectedPropertyName, testTable.GetPropertyNameFromControlName(expectedControlName));
        }
コード例 #3
0
        public void ConstructorTest()
        {
            TestIPageViewSite pageViewSite = new TestIPageViewSite();
            TestIPropertyPageUI testPageUI = new TestIPropertyPageUI();
            PropertyControlTable propertyControlTable = new PropertyControlTable();

            PropertyControlMap target = new PropertyControlMap(pageViewSite, testPageUI, propertyControlTable);

            Assert.IsNotNull(target);
        }
コード例 #4
0
        public void IPageViewSiteTest()
        {
            TestIPageViewSite pageViewSite = new TestIPageViewSite();
            TestIPropertyPageUI testPageUI = new TestIPropertyPageUI();
            PropertyControlTable propertyControlTable = new PropertyControlTable();

            PropertyControlMap target = new PropertyControlMap(pageViewSite, testPageUI, propertyControlTable);
            PropertyPageBase_PropertyControlMapAccessor mapAccessor = new PropertyPageBase_PropertyControlMapAccessor(target);

            Assert.AreEqual(pageViewSite, mapAccessor.m_pageViewSite);
        }
コード例 #5
0
        public void GetPropertyNameForControlNameTest()
        {
            PropertyControlTable testTable = new PropertyControlTable();
            Assert.IsNull(testTable.GetPropertyNameFromControlName(expectedControlName));

            testTable.Add(expectedPropertyName, expectedControlName);
            Assert.AreEqual(expectedPropertyName, testTable.GetPropertyNameFromControlName(expectedControlName));

            testTable.Remove(expectedPropertyName, expectedControlName);
            Assert.IsNull(testTable.GetPropertyNameFromControlName(expectedControlName));
        }
コード例 #6
0
        public void GetPropertyNamesTest()
        {
            PropertyControlTable testTable = new PropertyControlTable();
            string expectedPropertyName2 = "Property2";
            string expectedControlName2 = "Control2";

            testTable.Add(expectedPropertyName, expectedControlName);
            testTable.Add(expectedPropertyName2, expectedControlName2);

            List<string> propertyList = testTable.GetPropertyNames();

            Assert.AreEqual(2, propertyList.Count);
            Assert.IsTrue(propertyList.Contains(expectedPropertyName));
            Assert.IsTrue(propertyList.Contains(expectedPropertyName2));
        }
コード例 #7
0
 public PropertyControlMap(IPageViewSite pageViewSite, IPropertyPageUI propertyPageUI, PropertyControlTable propertyControlTable)
 {
     m_propertyControlTable = propertyControlTable;
     m_pageViewSite         = pageViewSite;
     m_propertyPageUI       = propertyPageUI;
 }
コード例 #8
0
		public PropertyControlMap(IPageViewSite pageViewSite, IPropertyPageUI propertyPageUI, PropertyControlTable propertyControlTable)
		{
			m_propertyControlTable = propertyControlTable;
			m_pageViewSite = pageViewSite;
			m_propertyPageUI = propertyPageUI;
		}
コード例 #9
0
        public void PropertyControlTableTest()
        {
            TestIPageViewSite pageViewSite = new TestIPageViewSite();
            TestIPropertyPageUI testPageUI = new TestIPropertyPageUI();
            PropertyControlTable propertyControlTable = new PropertyControlTable();
            string expectedPropertyName = "Property";
            string expectedControlName = "Control";
            propertyControlTable.Add(expectedPropertyName, expectedControlName);

            PropertyControlMap target = new PropertyControlMap(pageViewSite, testPageUI, propertyControlTable);
            PropertyPageBase_PropertyControlMapAccessor mapAccessor = new PropertyPageBase_PropertyControlMapAccessor(target);

            Assert.AreEqual(expectedControlName, mapAccessor.m_propertyControlTable.GetControlNameFromPropertyName(expectedPropertyName));
        }
コード例 #10
0
        public void UserEditChangedHandlerTest()
        {
            TestIPageViewSite pageViewSite = new TestIPageViewSite();
            TestIPropertyPageUI testPageUI = new TestIPropertyPageUI();
            PropertyControlTable propertyControlTable = new PropertyControlTable();

            string property1Name = "Property1";
            string property1ControlName = "TextBox1";
            string property1Value = "Value1";
            string property1NewValue = "Changed1";

            pageViewSite.PropertyNameValueDictionary.Add(property1Name, property1Value);
            propertyControlTable.Add(property1Name, property1ControlName);
            testPageUI.controlValues.Add(property1ControlName, "NotSet");

            PropertyControlMap map = new PropertyControlMap(pageViewSite, testPageUI, propertyControlTable);
            map.InitializeControls();

            testPageUI.SimulateUserEdit(property1ControlName, property1NewValue);
            Assert.AreEqual(1, pageViewSite.ChangedProperties.Count);
            Assert.AreEqual(property1NewValue, pageViewSite.ChangedProperties[property1Name]);
        }
コード例 #11
0
        public void RefreshPropertyValuesTest()
        {
            TestIPageViewSite pageViewSite = new TestIPageViewSite();
            TestIPropertyPageUI testPageUI = new TestIPropertyPageUI();
            PropertyControlTable propertyControlTable = new PropertyControlTable();

            string propertyName = "Property";
            string controlName = "Control";
            string initialValue = "Value1";
            string changedValue = "ChangedValue";

            pageViewSite.PropertyNameValueDictionary.Add(propertyName, initialValue);
            propertyControlTable.Add(propertyName, controlName);
            testPageUI.controlValues.Add(controlName, "NotSet");

            PropertyControlMap map = new PropertyControlMap(pageViewSite, testPageUI, propertyControlTable);
            map.InitializeControls();

            Assert.AreEqual(initialValue, testPageUI.controlValues[controlName]);

            pageViewSite.PropertyNameValueDictionary[propertyName] = changedValue;

            map.InitializeControls();

            Assert.AreEqual(changedValue, testPageUI.controlValues[controlName]);
        }
コード例 #12
0
        public void RemoveTest()
        {
            PropertyControlTable testTable = new PropertyControlTable();

            testTable.Add(expectedPropertyName, expectedControlName);
            Assert.IsNotNull(testTable.GetPropertyNameFromControlName(expectedControlName));
            Assert.IsNotNull(testTable.GetControlNameFromPropertyName(expectedPropertyName));

            testTable.Remove(expectedPropertyName, expectedControlName);
            Assert.IsNull(testTable.GetPropertyNameFromControlName(expectedControlName));
            Assert.IsNull(testTable.GetControlNameFromPropertyName(expectedPropertyName));
        }