public void GetRowSpanForColumnToTheRight_TwoColumns() { //---------------Set up test pack------------------- Hashtable parameters1 = new Hashtable(); parameters1.Add("rowSpan", 1); parameters1.Add("colSpan", 3); UIFormField field1 = CreateUIFormField("label2", "prop2", parameters1); Hashtable parameters2 = new Hashtable(); parameters2.Add("rowSpan", 2); parameters2.Add("colSpan", 2); UIFormField field2 = CreateUIFormField("label2", "prop2", parameters2); UIFormColumn uiFormColumn = new UIFormColumn(); uiFormColumn.Add(field1); uiFormColumn.Add(field2); //---------------Execute Test ---------------------- int rowsPanForColumnToTheRight1 = uiFormColumn.GetRowSpanForColumnToTheRight(1); int rowsPanForColumnToTheRight2 = uiFormColumn.GetRowSpanForColumnToTheRight(2); //---------------Test Result ----------------------- Assert.AreEqual(3, rowsPanForColumnToTheRight1); Assert.AreEqual(1, rowsPanForColumnToTheRight2); }
public void TestSync() { UIFormColumn uiFormColumn = new UIFormColumn(); Assert.AreEqual(typeof(object), uiFormColumn.SyncRoot.GetType()); Assert.IsFalse(uiFormColumn.IsSynchronized); }
public void Test_NotEqualsDiffFieldCount() { //---------------Set up test pack------------------- UIFormColumn uiFormColumn1 = new UIFormColumn(); UIFormField def = CreateUIFormField("bob", "bob"); uiFormColumn1.Add(def); UIFormColumn uiFormColumn2 = new UIFormColumn(); uiFormColumn2.Add(def); UIFormField def2 = CreateUIFormField("bob1", "bob1"); uiFormColumn1.Add(def); uiFormColumn1.Add(def2); uiFormColumn2.Add(def2); //--------------Assert PreConditions---------------- Assert.AreNotEqual(uiFormColumn1.Count, uiFormColumn2.Count); //---------------Execute Test ---------------------- bool operatorEquals = uiFormColumn1 == uiFormColumn2; bool equalsMethod = uiFormColumn1.Equals(uiFormColumn2); bool equalsObjectMethod = uiFormColumn1.Equals((object)uiFormColumn2); //---------------Test Result ----------------------- Assert.IsFalse(operatorEquals); Assert.IsFalse(equalsMethod); Assert.IsFalse(equalsObjectMethod); //---------------Tear Down ------------------------- }
public UIFormColumn CreateUIFormColumn_1Field(string propName) { UIFormColumn uiFormColumn = new UIFormColumn(); uiFormColumn.Add(CreateUIFormField("label1", propName, null)); return(uiFormColumn); }
private static ClassDef GetClassDef() { PropDef propDefPK = new PropDef(ENUM_PKPROP_NAME, typeof(Guid), PropReadWriteRule.WriteNew, null); PropDef propDef = new PropDef(ENUM_PROP_NAME, typeof(TestEnum), PropReadWriteRule.ReadWrite, TestEnum.Option1); PropDef propDef2 = new PropDef(ENUM_PROP_NAME_EMPTY, typeof(TestEnumEmpty), PropReadWriteRule.ReadWrite, null); PropDef propDef3 = new PropDef(ENUM_PROP_NAME_PASCAL, typeof(TestEnumPascalCase), PropReadWriteRule.ReadWrite, null); PrimaryKeyDef primaryKeyDef = new PrimaryKeyDef { propDefPK }; PropDefCol propDefCol = new PropDefCol { propDefPK, propDef, propDef2, propDef3 }; UIFormField uiFormField = new UIFormField(TestUtil.GetRandomString(), propDef.PropertyName, typeof(IComboBox), "EnumComboBoxMapper", "Habanero.Faces.Base", true, null, null, LayoutStyle.Label); UIFormColumn uiFormColumn = new UIFormColumn { uiFormField }; UIFormTab uiFormTab = new UIFormTab { uiFormColumn }; UIForm uiForm = new UIForm { uiFormTab }; UIDef uiDef = new UIDef("default", uiForm, null); UIDefCol uiDefCol = new UIDefCol { uiDef }; ClassDef classDef = new ClassDef(typeof(EnumBO), primaryKeyDef, propDefCol, new KeyDefCol(), null, uiDefCol); return(classDef); }
private UIFormTab CreateUIFormTab() { UIFormTab uiFormTab1 = new UIFormTab(); UIFormColumn uiFormColumn = CreateUIFormColumn_2Fields(); uiFormTab1.Add(uiFormColumn); return(uiFormTab1); }
public void Test_NotEqualsNull() { UIFormColumn uiFormColumn1 = new UIFormColumn(); const UIFormColumn uiFormColumn2 = null; Assert.IsFalse(uiFormColumn1 == uiFormColumn2); Assert.IsFalse(uiFormColumn2 == uiFormColumn1); Assert.IsFalse(uiFormColumn1.Equals(uiFormColumn2)); Assert.IsFalse(uiFormColumn1.Equals((object)uiFormColumn2)); }
public void TestRemove() { UIFormColumn column = new UIFormColumn(); UIFormTab uiFormTab = new UIFormTab(); uiFormTab.Add(column); Assert.IsTrue(uiFormTab.Contains(column)); uiFormTab.Remove(column); Assert.IsFalse(uiFormTab.Contains(column)); }
public void TestEquals_SameColumn() { UIFormTab uiFormTab1 = new UIFormTab(); UIFormColumn uiFormColumn = CreateUIFormColumn_2Fields(); UIFormTab uiFormTab2 = new UIFormTab(); uiFormTab1.Add(uiFormColumn); uiFormTab2.Add(uiFormColumn); Assert.IsTrue(uiFormTab2 == uiFormTab1); Assert.AreEqual(uiFormTab1, uiFormTab2); }
public UIFormColumn CreateUIFormColumn_2Fields(string propName) { UIFormField field1 = new UIFormField("label1", propName, "control", null, null, null, true, null, null, null, LayoutStyle.Label); UIFormField field2 = new UIFormField("label2", "prop2", "control", null, null, null, true, null, null, null, LayoutStyle.Label); UIFormColumn uiFormColumn = new UIFormColumn(); uiFormColumn.Add(field1); uiFormColumn.Add(field2); return(uiFormColumn); }
public void TestRemove() { UIFormField field = CreateUIFormField(); UIFormColumn uiFormColumn = new UIFormColumn(); uiFormColumn.Add(field); Assert.IsTrue(uiFormColumn.Contains(field)); uiFormColumn.Remove(field); Assert.IsFalse(uiFormColumn.Contains(field)); }
public UIFormColumn CreateUIFormColumn_1FieldWith2RowAnd3ColSpan() { Hashtable parameters = new Hashtable(); parameters.Add("rowSpan", 2); parameters.Add("colSpan", 3); UIFormField field1 = CreateUIFormField("label1", "prop1", parameters); UIFormColumn uiFormColumn = new UIFormColumn(); uiFormColumn.Add(field1); return(uiFormColumn); }
public UIFormColumn CreateUIFormColumn_2Fields(string propName) { UIFormField field1 = CreateUIFormField("label1", propName, null); UIFormField field2 = CreateUIFormField("label2", "prop2", null); UIFormColumn uiFormColumn = new UIFormColumn(); uiFormColumn.Add(field1); uiFormColumn.Add(field2); return(uiFormColumn); }
public void TestFormTab() { //---------------Set up test pack------------------- UIFormColumn column = new UIFormColumn(); UIFormTab tab = new UIFormTab(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- column.UIFormTab = tab; //---------------Test Result ----------------------- Assert.AreSame(tab, column.UIFormTab); }
public void TestAddColumn() { //---------------Set up test pack------------------- UIFormColumn uiFormColumn = new UIFormColumn(); UIFormTab uiFormTab = new UIFormTab(); //---------------Assert Precondition---------------- Assert.IsNull(uiFormColumn.UIFormTab); //---------------Execute Test ---------------------- uiFormTab.Add(uiFormColumn); //---------------Test Result ----------------------- Assert.AreSame(uiFormTab, uiFormColumn.UIFormTab); }
public void TestAddUIFormField() { //---------------Set up test pack------------------- UIFormField field1 = CreateUIFormField("label1", "prop1"); UIFormColumn uiFormColumn = new UIFormColumn(); //---------------Assert Precondition---------------- Assert.IsNull(field1.UIFormColumn); //---------------Execute Test ---------------------- uiFormColumn.Add(field1); //---------------Test Result ----------------------- Assert.AreSame(uiFormColumn, field1.UIFormColumn); }
public void TestFormColumn() { //---------------Set up test pack------------------- UIFormField uiFormField1 = CreateFormField(); UIFormColumn column = new UIFormColumn(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- uiFormField1.UIFormColumn = column; //---------------Test Result ----------------------- Assert.AreSame(column, uiFormField1.UIFormColumn); }
public void TestEquals_EqualColumn() { UIFormTab uiFormTab1 = new UIFormTab(); UIFormColumn uiFormColumn1 = CreateUIFormColumn_2Fields(); UIFormColumn uiFormColumn2 = CreateUIFormColumn_2Fields(); UIFormTab uiFormTab2 = new UIFormTab(); uiFormTab1.Add(uiFormColumn1); uiFormTab2.Add(uiFormColumn2); Assert.IsTrue(uiFormTab2 == uiFormTab1); Assert.IsFalse(uiFormTab2 != uiFormTab1); Assert.AreEqual(uiFormTab1, uiFormTab2); }
public UIFormColumn CreateUIFormColumn_2FieldsWithRowSpan() { UIFormField field1 = CreateUIFormField("label1", "prop1", null); Hashtable parameters = new Hashtable(); parameters.Add("rowSpan", 2); UIFormField field2 = CreateUIFormField("label2", "prop2", parameters); UIFormColumn uiFormColumn = new UIFormColumn(); uiFormColumn.Add(field1); uiFormColumn.Add(field2); return(uiFormColumn); }
public void TestCopyTo() { UIFormColumn column1 = new UIFormColumn(); UIFormColumn column2 = new UIFormColumn(); UIFormTab uiFormTab = new UIFormTab(); uiFormTab.Add(column1); uiFormTab.Add(column2); UIFormColumn[] target = new UIFormColumn[2]; uiFormTab.CopyTo(target, 0); Assert.AreEqual(column1, target[0]); Assert.AreEqual(column2, target[1]); }
public void TestCopyTo() { UIFormField field1 = CreateUIFormField(); UIFormField field2 = CreateUIFormField(); UIFormColumn uiFormColumn = new UIFormColumn(); uiFormColumn.Add(field1); uiFormColumn.Add(field2); UIFormField[] target = new UIFormField[2]; uiFormColumn.CopyTo(target, 0); Assert.AreEqual(field1, target[0]); Assert.AreEqual(field2, target[1]); }
public void Test_NotEquals() { UIFormColumn uiFormColumn1 = new UIFormColumn(); UIFormField def = CreateUIFormField("bob", "bob"); uiFormColumn1.Add(def); UIFormColumn uiFormColumn2 = new UIFormColumn(); UIFormField def2 = CreateUIFormField("bob1", "bob1"); uiFormColumn2.Add(def2); Assert.IsFalse(uiFormColumn1 == uiFormColumn2); Assert.IsFalse(uiFormColumn2 == uiFormColumn1); Assert.IsFalse(uiFormColumn1.Equals(uiFormColumn2)); Assert.IsFalse(uiFormColumn1.Equals((object)uiFormColumn2)); }
public void TestEquals() { UIFormColumn uiFormColumn1 = new UIFormColumn(); UIFormField def = CreateUIFormField(); uiFormColumn1.Add(def); UIFormColumn uiFormColumn2 = new UIFormColumn(); uiFormColumn2.Add(def); Assert.IsTrue(uiFormColumn1 == uiFormColumn2); Assert.IsTrue(uiFormColumn2 == uiFormColumn1); Assert.IsFalse(uiFormColumn2 != uiFormColumn1); Assert.IsTrue(uiFormColumn1.Equals(uiFormColumn2)); Assert.IsTrue(uiFormColumn1.Equals((object)uiFormColumn2)); }
public void Test_Insert_WhenNoItems_ShouldInsertInfirstLocation() { //---------------Set up test pack------------------- UIFormColumn column = new UIFormColumn(); UIFormField field = GetNewFormField(); //---------------Assert Precondition---------------- Assert.AreEqual(0, column.Count); //---------------Execute Test ---------------------- column.Insert(0, field); //---------------Test Result ----------------------- Assert.AreEqual(1, column.Count); Assert.AreSame(field, column[0]); Assert.AreSame(column, field.UIFormColumn); }
public void Test_Construct_WithUIFormColumns() { //---------------Set up test pack------------------- UIFormField uiFormField1 = new UIFormField("label1", "prop1"); UIFormField uiFormField2 = new UIFormField("label2", "prop2"); UIFormField uiFormField3 = new UIFormField("label3", "prop3"); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- UIFormColumn uiFormColumn = new UIFormColumn(uiFormField1, uiFormField2, uiFormField3); //---------------Test Result ----------------------- Assert.AreEqual(3, uiFormColumn.Count); Assert.AreSame(uiFormField1, uiFormColumn[0]); Assert.AreSame(uiFormField2, uiFormColumn[1]); Assert.AreSame(uiFormField3, uiFormColumn[2]); }
public void Test_Insert_WhenOneItem_ShouldInsertFieldAtIndex() { //---------------Set up test pack------------------- UIFormColumn column = new UIFormColumn(); UIFormField field = GetNewFormField(); column.Insert(0, GetNewFormField()); //---------------Assert Precondition---------------- Assert.AreEqual(1, column.Count); Assert.AreNotSame(field, column[0]); //---------------Execute Test ---------------------- column.Insert(0, field); //---------------Test Result ----------------------- Assert.AreEqual(2, column.Count); Assert.AreSame(field, column[0]); }
public void Test_Insert_WhenFieldAlreadyExists_DoesNothing() { //---------------Set up test pack------------------- UIFormColumn column = new UIFormColumn(); UIFormField field = GetNewFormField(); column.Insert(0, field); //---------------Assert Precondition---------------- Assert.AreEqual(1, column.Count); Assert.AreSame(field, column[0]); //---------------Execute Test ---------------------- column.Insert(0, field); //---------------Test Result ----------------------- Assert.AreEqual(1, column.Count); Assert.AreSame(field, column[0]); }
public void Test_Construct_WithUIFormColumns() { //---------------Set up test pack------------------- UIFormColumn uiFormColumn1 = new UIFormColumn(); UIFormColumn uiFormColumn2 = new UIFormColumn(); UIFormColumn uiFormColumn3 = new UIFormColumn(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- UIFormTab uiFormTab = new UIFormTab(uiFormColumn1, uiFormColumn2, uiFormColumn3); //---------------Test Result ----------------------- Assert.AreEqual(3, uiFormTab.Count); Assert.AreSame(uiFormColumn1, uiFormTab[0]); Assert.AreSame(uiFormColumn2, uiFormTab[1]); Assert.AreSame(uiFormColumn3, uiFormTab[2]); }
public void TestNotEquals_DifferentField() { UIFormTab uiFormTab1 = new UIFormTab(); UIFormColumn uiFormColumn1 = CreateUIFormColumn_2Fields(); UIFormColumn uiFormColumn2 = CreateUIFormColumn_2Fields("diffProp"); UIFormTab uiFormTab2 = new UIFormTab(); uiFormTab1.Add(uiFormColumn1); uiFormTab2.Add(uiFormColumn2); Assert.IsFalse(uiFormTab2 == uiFormTab1); Assert.IsTrue(uiFormTab2 != uiFormTab1); Assert.IsFalse(uiFormTab1.Equals(uiFormTab2)); //Assert.AreNotEqual(uiFormTab1, uiFormTab2); }
public void Test_Insert_WhenIndexNegative_AddsItemToBeginOfList() { //---------------Set up test pack------------------- UIFormColumn column = new UIFormColumn(); UIFormField field = GetNewFormField(); column.Insert(0, GetNewFormField()); //---------------Assert Precondition---------------- Assert.AreEqual(1, column.Count); Assert.AreNotSame(field, column[0]); //---------------Execute Test ---------------------- column.Insert(-1, field); //---------------Test Result ----------------------- Assert.AreEqual(2, column.Count); Assert.AreSame(field, column[0]); }