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);
        }
        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);
        }
        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);
        }
        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));
        }
        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]);
        }
        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]);
        }
		public PageView(IPageViewSite pageViewSite)
		{
			m_propertyControlMap = new PropertyControlMap(pageViewSite, this, PropertyControlTable);
		}
Esempio n. 8
0
 public PageView(IPageViewSite pageViewSite)
 {
     m_propertyControlMap = new PropertyControlMap(pageViewSite, this, PropertyControlTable);
 }