コード例 #1
0
        public void Test_UIFormTab()
        {
            //--------------- Set up test pack ------------------
            IClassDef    classDef     = Sample.CreateClassDefWithTwoPropsOneInteger();
            PanelBuilder panelBuilder = new PanelBuilder(GetControlFactory());
            //--------------- Test Preconditions ----------------

            //--------------- Execute Test ----------------------
            IPanelInfo panelInfo = panelBuilder.BuildPanelForTab((UIFormTab)classDef.UIDefCol["default"].UIForm[0]);

            //--------------- Test Result -----------------------
            Assert.IsNotNull(panelInfo.UIFormTab);
            Assert.AreEqual(panelInfo.UIFormTab.Name, panelInfo.PanelTabText);
        }
コード例 #2
0
        public void TestControlsVisible()
        {
            //---------------Set up test pack-------------------
            IClassDef    classDef     = Sample.CreateClassDefWithTwoPropsOneInteger();
            PanelBuilder panelBuilder = new PanelBuilder(GetControlFactory());
            IPanelInfo   panelInfo    = panelBuilder.BuildPanelForTab((UIFormTab)classDef.UIDefCol["default"].UIForm[0]);

            panelInfo.BusinessObject = new Sample();
            //---------------Assert Precondition----------------
            Assert.IsTrue(panelInfo.FieldInfos[0].InputControl.Visible);
            Assert.IsTrue(panelInfo.FieldInfos[1].InputControl.Visible);
            //---------------Execute Test ----------------------
            panelInfo.ControlsVisible = false;
            //---------------Test Result -----------------------
            Assert.IsFalse(panelInfo.FieldInfos[0].InputControl.Visible);
            Assert.IsFalse(panelInfo.FieldInfos[1].InputControl.Visible);
        }
コード例 #3
0
        public void Test_UpdateErrorProviderError_WhenBOValid_ShouldClearErrorMessage()
        {
            //---------------Set up test pack-------------------
            ContactPersonTestBO.LoadDefaultClassDefWithUIDef();
            ContactPersonTestBO person       = ContactPersonTestBO.CreateUnsavedContactPerson("", "");
            PanelBuilder        panelBuilder = new PanelBuilder(GetControlFactory());
            IPanelInfo          panelInfo    = panelBuilder.BuildPanelForTab((UIFormTab)person.ClassDef.UIDefCol["default"].UIForm[0]);

            panelInfo.BusinessObject = person;
            IControlMapper SurnameControlMapper = panelInfo.FieldInfos["Surname"].ControlMapper;

            panelInfo.UpdateErrorProvidersErrorMessages();
            //---------------Assert Precondition----------------
            Assert.AreNotEqual("", SurnameControlMapper.GetErrorMessage());
            //---------------Execute Test ----------------------
            person.Surname = "SomeValue";
            panelInfo.UpdateErrorProvidersErrorMessages();
            //---------------Test Result -----------------------
            Assert.AreEqual("", SurnameControlMapper.GetErrorMessage());
        }
コード例 #4
0
        public void TestClearErrorProviders()
        {
            //---------------Set up test pack-------------------
            IClassDef    classDef       = Sample.CreateClassDefWithTwoPropsOneCompulsory();
            PanelBuilder panelBuilder   = new PanelBuilder(GetControlFactory());
            IPanelInfo   panelInfo      = panelBuilder.BuildPanelForTab((UIFormTab)classDef.UIDefCol["default"].UIForm[0]);
            Sample       businessObject = new Sample();

            panelInfo.BusinessObject = businessObject;

            //businessObject.SetPropertyValue("SampleText2", "sdlkfj");
            PanelInfo.FieldInfo fieldInfo = panelInfo.FieldInfos["SampleText2"];
            panelInfo.ApplyChangesToBusinessObject();
            IErrorProvider errorProvider = fieldInfo.ControlMapper.ErrorProvider;

            //---------------Assert Precondition----------------
            Assert.IsTrue(errorProvider.GetError(fieldInfo.InputControl).Length > 0);
            //---------------Execute Test ----------------------
            panelInfo.ClearErrorProviders();
            //---------------Test Result -----------------------
            Assert.IsFalse(errorProvider.GetError(fieldInfo.InputControl).Length > 0);
        }