Inheritance: Habanero.Faces.Base.LookupComboBoxMapper
Beispiel #1
0
        public void TestCustomiseLookupList_Add()
        {
            //---------------Set up test pack-------------------
            IComboBox    cmbox    = GetControlFactory().CreateComboBox();
            const string propName = "SampleLookup2ID";
            CustomAddLookupComboBoxMapperStub mapperStub = new CustomAddLookupComboBoxMapperStub(cmbox, propName, false, GetControlFactory());
            Sample sample = new Sample();

            //---------------Execute Test ----------------------
            mapperStub.BusinessObject = sample;

            //---------------Test Result -----------------------
            Assert.AreEqual(5, cmbox.Items.Count);
            Assert.AreEqual("ExtraLookupItem", LastComboBoxItem(cmbox).ToString());

            //---------------Tear Down -------------------------
            // This test changes the static class def, so force a reload
            ClassDef.ClassDefs.Remove(typeof(Sample));
        }
Beispiel #2
0
        public void TestCustomiseLookupList_Add_SelectAdded()
        {
            //---------------Set up test pack-------------------
            IComboBox    cmbox    = GetControlFactory().CreateComboBox();
            const string propName = "SampleLookup2ID";
            CustomAddLookupComboBoxMapperStub mapperStub = new CustomAddLookupComboBoxMapperStub(cmbox, propName, false, GetControlFactory());
            Sample sample = new Sample();

            mapperStub.BusinessObject = sample;
            //---------------Assert Preconditions---------------
            Assert.AreEqual(5, cmbox.Items.Count);
            Assert.AreEqual("ExtraLookupItem", LastComboBoxItem(cmbox).ToString());
            //---------------Execute Test ----------------------
            cmbox.SelectedIndex = cmbox.Items.Count - 1;
            mapperStub.ApplyChangesToBusinessObject();
            //---------------Test Result -----------------------
            object value = sample.GetPropertyValue(propName);

            Assert.IsNotNull(value);

            //---------------Tear Down -------------------------
            // This test changes the static class def, so force a reload
            ClassDef.ClassDefs.Remove(typeof(Sample));
        }
        public void TestCustomiseLookupList_Add_SelectAdded()
        {
            //---------------Set up test pack-------------------
            IComboBox cmbox = GetControlFactory().CreateComboBox();
            const string propName = "SampleLookup2ID";
            CustomAddLookupComboBoxMapperStub mapperStub = new CustomAddLookupComboBoxMapperStub(cmbox, propName, false, GetControlFactory());
            Sample sample = new Sample();
            mapperStub.BusinessObject = sample;
            //---------------Assert Preconditions---------------
            Assert.AreEqual(5, cmbox.Items.Count);
            Assert.AreEqual("ExtraLookupItem", LastComboBoxItem(cmbox).ToString());
            //---------------Execute Test ----------------------
            cmbox.SelectedIndex = cmbox.Items.Count - 1;
            mapperStub.ApplyChangesToBusinessObject();
            //---------------Test Result -----------------------
            object value = sample.GetPropertyValue(propName);
            Assert.IsNotNull(value);

            //---------------Tear Down -------------------------
            // This test changes the static class def, so force a reload
            ClassDef.ClassDefs.Remove(typeof(Sample));
        }
        public void TestCustomiseLookupList_Add()
        {
            //---------------Set up test pack-------------------
            IComboBox cmbox = GetControlFactory().CreateComboBox();
            const string propName = "SampleLookup2ID";
            CustomAddLookupComboBoxMapperStub mapperStub = new CustomAddLookupComboBoxMapperStub(cmbox, propName, false, GetControlFactory());
            Sample sample = new Sample();

            //---------------Execute Test ----------------------
            mapperStub.BusinessObject = sample;

            //---------------Test Result -----------------------
            Assert.AreEqual(5, cmbox.Items.Count);
            Assert.AreEqual("ExtraLookupItem", LastComboBoxItem(cmbox).ToString());

            //---------------Tear Down -------------------------
            // This test changes the static class def, so force a reload
            ClassDef.ClassDefs.Remove(typeof(Sample));
        }