public void TestSetList_ToEmptyString_ShouldNotRaiseError()
        {
            //---------------Set up test pack-------------------
            IComboBox          cbx      = GetControlFactory().CreateComboBox();
            const string       propName = "propname";
            ListComboBoxMapper mapper   = new ListComboBoxMapper(cbx, propName, false, GetControlFactory());

            //---------------Execute Test ----------------------
            mapper.SetList("");
            //---------------Test Result -----------------------
            Assert.AreEqual(1, cbx.Items.Count);
        }
        public void TestSetList()
        {
            //---------------Set up test pack-------------------
            IComboBox          cbx      = GetControlFactory().CreateComboBox();
            const string       propName = "propname";
            ListComboBoxMapper mapper   = new ListComboBoxMapper(cbx, propName, false, GetControlFactory());

            //---------------Execute Test ----------------------
            mapper.SetList("One|Two|Three|Four");
            //---------------Test Result -----------------------
            Assert.AreEqual(4, cbx.Items.Count);
            Assert.AreSame(typeof(string), cbx.Items[0].GetType());
            Assert.IsTrue(cbx.Items.Contains("Two"));
            //---------------Tear Down -------------------------
        }
        public void TestSetBusinessObject()
        {
            //---------------Set up test pack-------------------
            IComboBox          cbx      = GetControlFactory().CreateComboBox();
            const string       propName = "SampleText";
            ListComboBoxMapper mapper   = new ListComboBoxMapper(cbx, propName, false, GetControlFactory());

            mapper.SetList("One|Two|Three|Four");
            Sample s = new Sample();

            s.SampleText = "Three";
            //---------------Execute Test ----------------------
            mapper.BusinessObject = s;
            //---------------Test Result -----------------------
            Assert.AreEqual("Three", cbx.SelectedItem, "Value is not set.");

            //---------------Tear Down -------------------------
        }
Пример #4
0
        public void TestSetComboBoxUpdatesBO_WithoutCallingApplyChanges()
        {
            //---------------Set up test pack-------------------
            IComboBox          cbx      = GetControlFactory().CreateComboBox();
            const string       propName = "SampleText";
            ListComboBoxMapper mapper   = new ListComboBoxMapper(cbx, propName, false, GetControlFactory());

            mapper.SetList("One|Two|Three|Four");
            Sample s = new Sample();

            s.SampleText          = "Three";
            mapper.BusinessObject = s;
            //---------------Execute Test ----------------------
            cbx.SelectedIndex = 0;
            //---------------Test Result -----------------------
            Assert.AreEqual(cbx.SelectedItem, s.SampleText,
                            "BO property value isn't changed when control value is changed.");
        }
        public void TestSetBusinessObject_Null_ShouldNotRaiseError_BUGFIX()
        {
            //---------------Set up test pack-------------------
            IComboBox          cbx      = GetControlFactory().CreateComboBox();
            const string       propName = "SampleText";
            ListComboBoxMapper mapper   = new ListComboBoxMapper(cbx, propName, false, GetControlFactory());

            mapper.SetList("One|Two|Three|Four");
            Sample s = new Sample {
                SampleText = "Three"
            };

            //---------------Execute Test ----------------------
            mapper.BusinessObject = null;
            //---------------Test Result -----------------------
            Assert.AreEqual(null, cbx.SelectedItem, "Value is not set to null.");

            //---------------Tear Down -------------------------
        }
Пример #6
0
        public void TestChangeBusinessObjectUpdatesComboBox_WithoutCallingUpdateControlValue()
        {
            //---------------Set up test pack-------------------
            IComboBox          cbx      = GetControlFactory().CreateComboBox();
            const string       propName = "SampleText";
            ListComboBoxMapper mapper   = new ListComboBoxMapper(cbx, propName, false, GetControlFactory());

            mapper.SetList("One|Two|Three|Four");
            Sample s = new Sample {
                SampleText = "Three"
            };

            mapper.BusinessObject = s;
            //---------------Execute Test ----------------------
            s.SampleText = "Four";

            //---------------Test Result -----------------------
            Assert.AreEqual("Four", cbx.SelectedItem, "Value is not set.");
        }