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 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 TestCloneUIForm() { //---------------Set up test pack------------------- UIFormField field1 = new UIFormField("label1", "prop1", "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); UIFormTab uiFormTab = new UIFormTab("Tab1"); uiFormTab.Add(uiFormColumn); UIForm uiForm = new UIForm(); uiForm.Add(uiFormTab); uiForm.Title = "ddd"; uiForm.Height = 1; uiForm.Width = 3; //---------------Execute Test ---------------------- IUIForm clonedForm = uiForm.Clone(); //---------------Test Result ----------------------- Assert.IsTrue(uiForm == (UIForm)clonedForm); Assert.IsTrue(uiForm.Equals(clonedForm)); Assert.AreNotSame(uiForm, clonedForm); IUIFormTab clonedUIFormTab = clonedForm[0]; Assert.AreEqual(uiForm[0], clonedUIFormTab, "Should be a deep copy and the columns should be equal but copied"); Assert.AreNotSame(uiFormTab, clonedUIFormTab, "Should be a deep copy and the columns should be equal but copied (not same)"); //Verif cloned columns Assert.AreEqual(uiFormTab[0], clonedUIFormTab[0]); Assert.AreNotSame(uiFormTab[0], clonedUIFormTab[0]); }
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 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 void TestGetMaximumFieldCount() { //---------------Set up test pack------------------- UIFormTab uiFormTab1 = new UIFormTab("tab1"); uiFormTab1.Add(CreateUIFormColumn_2Fields()); uiFormTab1.Add(CreateUIFormColumn_1Field()); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- int maxFieldCount = uiFormTab1.GetMaxFieldCount(); //---------------Test Result ----------------------- Assert.AreEqual(2, maxFieldCount); }
public void TestGetMaxRowsInColumns_RowAndColSpan_3Cols() { //---------------Set up test pack------------------- UIFormTab uiFormTab1 = new UIFormTab("tab1"); uiFormTab1.Add(CreateUIFormColumn_1FieldWith2RowAnd3ColSpan()); uiFormTab1.Add(CreateUIFormColumn_1FieldWith2RowAnd2ColSpan()); uiFormTab1.Add(CreateUIFormColumn_1Field()); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- int maxFieldCount = uiFormTab1.GetMaxRowsInColumns(); //---------------Test Result ----------------------- Assert.AreEqual(5, maxFieldCount); }
public void TestNotEquals_DiffColCount() { //---------------Set up test pack------------------- UIFormTab uiFormTab1 = new UIFormTab(); UIFormColumn uiFormColumn1 = CreateUIFormColumn_2Fields(); UIFormColumn uiFormColumn2 = CreateUIFormColumn_2Fields("diffProp"); UIFormTab uiFormTab2 = new UIFormTab(); //--------------Assert PreConditions---------------- //---------------Execute Test ---------------------- uiFormTab1.Add(uiFormColumn1); uiFormTab1.Add(uiFormColumn2); uiFormTab2.Add(uiFormColumn2); //---------------Test Result ----------------------- Assert.IsFalse(uiFormTab2 == uiFormTab1); Assert.IsFalse(uiFormTab1.Equals(uiFormTab2)); //---------------Tear Down ------------------------- }
public void TestNotEquals_DifferentTabName() { //---------------Set up test pack------------------- UIFormTab uiFormTab1 = new UIFormTab("tab1"); uiFormTab1.Add(CreateUIFormColumn_2Fields()); UIFormTab uiFormTab2 = new UIFormTab("tab2"); uiFormTab2.Add(CreateUIFormColumn_2Fields()); //--------------Assert PreConditions---------------- Assert.AreNotEqual(uiFormTab2.Name, uiFormTab1.Name); //---------------Execute Test ---------------------- Assert.IsFalse(uiFormTab2 == uiFormTab1); Assert.IsFalse(uiFormTab1.Equals(uiFormTab2)); //Assert.AreNotEqual(uiFormTab1, uiFormTab2); //---------------Test Result ----------------------- //---------------Tear Down ------------------------- }
private static UIForm GetUiForm() { UIFormField field1 = new UIFormField("label1", "prop1", "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); UIFormTab uiFormTab = new UIFormTab("Tab1"); uiFormTab.Add(uiFormColumn); UIForm uiForm = new UIForm(); uiForm.Add(uiFormTab); uiForm.Title = "ddd"; uiForm.Height = 1; uiForm.Width = 3; return uiForm; }
public UIForm SampleUserInterfaceMapperDescribedPropOnly(string toolTipText) { UIForm def = new UIForm(); def.Height = 300; def.Width = 350; UIFormTab tab = new UIFormTab(); def.Add(tab); UIFormColumn col = new UIFormColumn(100); tab.Add(col); col.Add(new UIFormField("Described Text:", "SampleTextDescribed", _textBoxTypeName, _textBoxAssemblyName, "TextBoxMapper", "", true, null, toolTipText, new Hashtable(), LayoutStyle.Label)); return def; }
private UIFormTab CreateUIFormTab() { UIFormTab uiFormTab1 = new UIFormTab(); UIFormColumn uiFormColumn = CreateUIFormColumn_2Fields(); uiFormTab1.Add(uiFormColumn); return uiFormTab1; }
public UIForm SampleUserInterfaceMapper2Tabs() { UIForm def = new UIForm(); def.Height = 300; def.Width = 350; UIFormTab tab1 = new UIFormTab("mytab1"); UIFormTab tab2 = new UIFormTab("mytab2"); UIFormColumn col1 = new UIFormColumn(100); UIFormColumn col2 = new UIFormColumn(150); col1.Add( new UIFormField("Text:", "SampleText", _textBoxTypeName, _textBoxAssemblyName, "TextBoxMapper", "", true, null, null, new Hashtable(), LayoutStyle.Label)); col1.Add( new UIFormField("Date:", "SampleDate", _dateTimePickerTypeName, _dateTimePickerAssemblyName, _dateTimePickerMapperName, "", true, null, null, new Hashtable(), LayoutStyle.Label)); col2.Add( new UIFormField("Text2:", "SampleText2", _textBoxTypeName, _textBoxAssemblyName, "TextBoxMapper", "", true, null, null, new Hashtable(), LayoutStyle.Label)); tab1.Add(col1); tab2.Add(col2); def.Add(tab1); def.Add(tab2); return def; }
public void Test_SetClassDef_ShouldSetClassDefOnFormFields() { //---------------Set up test pack------------------- var uiForm = new UIForm(); var uiFormTab = new UIFormTab(); var uiFormColumn = new UIFormColumn(); var uiFormField = new UIFormField("fdafad", "fdafasd"); uiForm.Add(uiFormTab); uiFormTab.Add(uiFormColumn); uiFormColumn.Add(uiFormField); var classDef = MockRepository.GenerateStub<IClassDef>(); //---------------Assert Precondition---------------- Assert.IsNull(uiFormField.ClassDef); //---------------Execute Test ---------------------- uiForm.ClassDef = classDef; //---------------Test Result ----------------------- Assert.AreSame(classDef, uiFormField.ClassDef); }
public void TestCloneUIForm() { //---------------Set up test pack------------------- UIFormField field1 = new UIFormField("label1", "prop1", "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); UIFormTab uiFormTab = new UIFormTab("Tab1"); uiFormTab.Add(uiFormColumn); UIForm uiForm = new UIForm(); uiForm.Add(uiFormTab); uiForm.Title = "ddd"; uiForm.Height = 1; uiForm.Width = 3; //---------------Execute Test ---------------------- IUIForm clonedForm = uiForm.Clone(); //---------------Test Result ----------------------- Assert.IsTrue(uiForm == (UIForm) clonedForm); Assert.IsTrue(uiForm.Equals(clonedForm)); Assert.AreNotSame(uiForm, clonedForm); IUIFormTab clonedUIFormTab = clonedForm[0]; Assert.AreEqual(uiForm[0], clonedUIFormTab, "Should be a deep copy and the columns should be equal but copied"); Assert.AreNotSame(uiFormTab, clonedUIFormTab, "Should be a deep copy and the columns should be equal but copied (not same)"); //Verif cloned columns Assert.AreEqual(uiFormTab[0], clonedUIFormTab[0]); Assert.AreNotSame(uiFormTab[0], clonedUIFormTab[0]); }
public UIForm SampleUserInterface_WriteNewRule() { UIForm def = new UIForm(); def.Height = 300; def.Width = 350; UIFormTab tab = new UIFormTab(); UIFormColumn col = new UIFormColumn(100); Hashtable propertyAttributes = new Hashtable(); propertyAttributes.Add("readWriteRule", "WriteNew"); col.Add( new UIFormField("Text:", "SampleText", _textBoxTypeName, _textBoxAssemblyName, "TextBoxMapper", "", true, null, null, propertyAttributes, LayoutStyle.Label)); col.Add( new UIFormField("Text2:", "SampleText2", _textBoxTypeName, _textBoxAssemblyName, "TextBoxMapper", "", true, null, null, new Hashtable(), LayoutStyle.Label)); tab.Add(col); def.Add(tab); return def; }
public UIForm SampleUserInterface_CustomMapper_WithAttributes(string mapperTypeName, string mapperAssemblyName, string attributeName, string attributeValue) { UIForm def = new UIForm(); def.Height = 300; def.Width = 350; UIFormTab tab = new UIFormTab(); UIFormColumn col = new UIFormColumn(100); Hashtable propertyAttributes = new Hashtable(); propertyAttributes.Add(attributeName, attributeValue); col.Add(new UIFormField("Text:", "SampleText", _textBoxTypeName, _textBoxAssemblyName, mapperTypeName, mapperAssemblyName, false, null, null, propertyAttributes, LayoutStyle.Label)); tab.Add(col); def.Add(tab); return def; }
public UIForm SampleUserInterfaceMapperRowSpanning() { UIForm def = new UIForm(); def.Height = 300; def.Width = 350; UIFormTab tab = new UIFormTab(); UIFormColumn col = new UIFormColumn(100); Hashtable propertyAttributes = new Hashtable(); propertyAttributes.Add("numLines", 3); propertyAttributes.Add("rowSpan", 2); col.Add( new UIFormField("Text:", "SampleText", _textBoxTypeName, _textBoxAssemblyName, "TextBoxMapper", "", false, null, null, propertyAttributes, LayoutStyle.Label)); tab.Add(col); UIFormColumn col2 = new UIFormColumn(100); col2.Add( new UIFormField("Text2:", "SampleText2", _textBoxTypeName, _textBoxAssemblyName, "TextBoxMapper", "", false, null, null, new Hashtable(), LayoutStyle.Label)); col2.Add( new UIFormField("Text2:", "SampleText2", _textBoxTypeName, _textBoxAssemblyName, "TextBoxMapper", "", false, null, null, new Hashtable(), LayoutStyle.Label)); tab.Add(col2); def.Add(tab); return def; }
public void TestCloneUIFormTab() { //---------------Set up test pack------------------- UIFormField field1 = CreateUIFormField("label1", "prop1", null); UIFormField field2 = CreateUIFormField("label2", "prop2", null); UIFormColumn uiFormColumn = new UIFormColumn(); uiFormColumn.Add(field1); uiFormColumn.Add(field2); UIFormTab uiFormTab = new UIFormTab("Tab1"); uiFormTab.Add(uiFormColumn); //---------------Execute Test ---------------------- IUIFormTab clonedFormTab = uiFormTab.Clone(); //---------------Test Result ----------------------- Assert.IsTrue(uiFormTab == (UIFormTab) clonedFormTab); Assert.IsTrue(uiFormTab.Equals(clonedFormTab)); Assert.AreEqual(uiFormTab[0], clonedFormTab[0], "Should be a deep copy and the columns should be equal but copied"); Assert.AreNotSame(uiFormTab[0], clonedFormTab[0], "Should be a deep copy and the columns should be equal but copied (not same)"); }
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 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 UIForm GetUIFormProperties() { UIForm def = new UIForm(); def.Height = 300; def.Width = 350; UIFormTab tab = new UIFormTab(); UIFormColumn col = new UIFormColumn(100); Hashtable propertyAttributes = new Hashtable(); propertyAttributes.Add("numLines", 3); col.Add( new UIFormField("Text:", "SampleText", _textBoxTypeName, _textBoxAssemblyName, "TextBoxMapper", "", false, null, null, propertyAttributes, LayoutStyle.Label)); tab.Add(col); def.Add(tab); return def; }