public void TestLabelText_UsesQuestionMark_WhenCheckBoxField() { XmlUIFormFieldLoader loader = new XmlUIFormFieldLoader(new DtdLoader(), new DefClassFactory()); UIFormField uiProp = (UIFormField)loader.LoadUIProperty(@"<field property=""TestPropName"" type=""CheckBox"" />"); Assert.AreEqual(null, uiProp.Label); Assert.AreEqual("Test Prop Name?", uiProp.GetLabel()); }
public void TestLabelText_UsesPropertyNameWithCamelCase() { XmlUIFormFieldLoader loader = new XmlUIFormFieldLoader(new DtdLoader(), new DefClassFactory()); UIFormField uiProp = (UIFormField)loader.LoadUIProperty(@"<field property=""TestPropName"" />"); Assert.AreEqual(null, uiProp.Label); Assert.AreEqual("Test Prop Name:", uiProp.GetLabel()); }
public void TestLayoutStyle() { //---------------Set up test pack------------------- loader = new XmlUIFormFieldLoader(new DtdLoader(), GetDefClassFactory()); //---------------Execute Test ---------------------- IUIFormField field = loader.LoadUIProperty(@"<field property=""prop"" layout=""GroupBox"" />"); //---------------Test Result ----------------------- Assert.AreEqual(LayoutStyle.GroupBox, field.Layout); //---------------Tear Down ------------------------- }
public void TestLayoutStyle_Invalid() { //---------------Set up test pack------------------- loader = new XmlUIFormFieldLoader(new DtdLoader(), GetDefClassFactory()); //---------------Execute Test ---------------------- try { IUIFormField field = loader.LoadUIProperty(@"<field property=""prop"" layout=""Invalid"" />"); Assert.Fail("Invalid layout should raise an error"); } //---------------Test Result ----------------------- catch (InvalidXmlDefinitionException ex) { StringAssert.Contains("In the definition for the field 'prop' the 'layout' " + "was set to an invalid value ('Invalid'). The valid options are " + "Label and GroupBox.", ex.Message); } //---------------Tear Down ------------------------- }
public void TestSimpleUIProperty() { IUIFormField uiProp = loader.LoadUIProperty( @"<field label=""testlabel"" property=""testpropname"" type=""TextBox"" assembly=""System.Windows.Forms"" mapperType=""TextBoxMapper"" mapperAssembly=""Habanero.Faces.Base"" editable=""false"" />"); Assert.AreEqual("testlabel", uiProp.Label); Assert.AreEqual("testpropname", uiProp.PropertyName); Assert.AreEqual("TextBox", uiProp.ControlTypeName); Assert.AreEqual("System.Windows.Forms", uiProp.ControlAssemblyName); Assert.AreEqual("Habanero.Faces.Base", uiProp.MapperAssembly); Assert.AreEqual("TextBoxMapper", uiProp.MapperTypeName); Assert.AreEqual(false, uiProp.Editable); }