Ejemplo n.º 1
0
 public void Test_GetLabel_WhenUIFormFieldHasClassDef()
 {
     //---------------Set up test pack-------------------
     ClassDef classDef = CreateTestClassDef("");
     var uiFormField = new UIFormFieldStub(null, "TestProperty");
     uiFormField.SetLabel(null);
     uiFormField.SetClassDef(classDef);
     //---------------Assert Precondition----------------
     Assert.IsNotNull(classDef.GetPropDef(uiFormField.PropertyName));
     //Assert.AreSame(classDef, uiFormField.GetClassDef());
     Assert.AreSame(classDef, uiFormField.ClassDef);
     Assert.IsNull(uiFormField.Label);
     //---------------Execute Test ----------------------
     var actualLabel = uiFormField.GetLabel();
     //---------------Test Result -----------------------
     Assert.AreEqual("Tested Property:", actualLabel);
 }
Ejemplo n.º 2
0
        public void Test_GetLabel_WhenUIFormFieldHasClassDef()
        {
            //---------------Set up test pack-------------------
            ClassDef classDef    = CreateTestClassDef("");
            var      uiFormField = new UIFormFieldStub(null, "TestProperty");

            uiFormField.SetLabel(null);
            uiFormField.SetClassDef(classDef);
            //---------------Assert Precondition----------------
            Assert.IsNotNull(classDef.GetPropDef(uiFormField.PropertyName));
            //Assert.AreSame(classDef, uiFormField.GetClassDef());
            Assert.AreSame(classDef, uiFormField.ClassDef);
            Assert.IsNull(uiFormField.Label);
            //---------------Execute Test ----------------------
            var actualLabel = uiFormField.GetLabel();

            //---------------Test Result -----------------------
            Assert.AreEqual("Tested Property:", actualLabel);
        }
Ejemplo n.º 3
0
        public void TestProtectedSets()
        {
            UIFormFieldStub field = new UIFormFieldStub();

            Assert.AreEqual("label", field.Label);
            field.SetLabel("newlabel");
            Assert.AreEqual("newlabel", field.Label);

            Assert.AreEqual("prop", field.PropertyName);
            field.SetPropertyName("newprop");
            Assert.AreEqual("newprop", field.PropertyName);

            Assert.IsNull(field.MapperTypeName);
            field.SetMapperTypeName("mapper");
            Assert.AreEqual("mapper", field.MapperTypeName);

            Assert.IsNull(field.MapperAssembly);

            Assert.IsNull(field.ControlType);
            field.SetControlType(typeof(ComboBox));
            Assert.AreEqual(typeof(ComboBox), field.ControlType);

            Assert.AreEqual("ComboBox", field.ControlTypeName);
            field.SetControlTypeName("TextBox");
            Assert.AreEqual("TextBox", field.ControlTypeName);
            Assert.AreEqual(typeof(TextBox), field.ControlType);

            Assert.AreEqual("System.Windows.Forms", field.ControlAssemblyName);
            field.SetControlAssemblyName("assem");
            Assert.AreEqual("assem", field.ControlAssemblyName);
            Assert.IsNull(field.ControlType);
            Assert.IsNull(field.ControlTypeName);

            Assert.IsTrue(field.Editable);
            field.SetEditable(false);
            Assert.IsFalse(field.Editable);
        }
Ejemplo n.º 4
0
        public void TestProtectedSets()
        {
            UIFormFieldStub field = new UIFormFieldStub();
            
            Assert.AreEqual("label", field.Label);
            field.SetLabel("newlabel");
            Assert.AreEqual("newlabel", field.Label);

            Assert.AreEqual("prop", field.PropertyName);
            field.SetPropertyName("newprop");
            Assert.AreEqual("newprop", field.PropertyName);

            Assert.IsNull(field.MapperTypeName);
            field.SetMapperTypeName("mapper");
            Assert.AreEqual("mapper", field.MapperTypeName);

            Assert.IsNull(field.MapperAssembly);

            Assert.IsNull(field.ControlType);
            field.SetControlType(typeof(ComboBox));
            Assert.AreEqual(typeof(ComboBox), field.ControlType);

            Assert.AreEqual("ComboBox", field.ControlTypeName);
            field.SetControlTypeName("TextBox");
            Assert.AreEqual("TextBox", field.ControlTypeName);
            Assert.AreEqual(typeof(TextBox), field.ControlType);

            Assert.AreEqual("System.Windows.Forms", field.ControlAssemblyName);
            field.SetControlAssemblyName("assem");
            Assert.AreEqual("assem", field.ControlAssemblyName);
            Assert.IsNull(field.ControlType);
            Assert.IsNull(field.ControlTypeName);

            Assert.IsTrue(field.Editable);
            field.SetEditable(false);
            Assert.IsFalse(field.Editable);
        }