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 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 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 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 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() { 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 UIFormColumn CreateUIFormColumn_1Field(string propName) { UIFormColumn uiFormColumn = new UIFormColumn(); uiFormColumn.Add(CreateUIFormField("label1", propName, null)); return(uiFormColumn); }
public void Test_NotEquals_SameFirstItemDiffSecondItem() { UIFormColumn uiFormColumn1 = new UIFormColumn(); UIFormField def = CreateUIFormField("bob", "bob"); uiFormColumn1.Add(def); UIFormColumn uiFormColumn2 = new UIFormColumn(); uiFormColumn2.Add(def); UIFormField def2 = CreateUIFormField("bob1", "bob1"); uiFormColumn2.Add(def2); Assert.IsFalse(uiFormColumn1 == uiFormColumn2); Assert.IsTrue(uiFormColumn1 != uiFormColumn2); Assert.IsFalse(uiFormColumn2 == uiFormColumn1); Assert.IsFalse(uiFormColumn1.Equals(uiFormColumn2)); Assert.IsFalse(uiFormColumn1.Equals((object)uiFormColumn2)); }
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 void TestCloneUIFormColumn() { //---------------Set up test pack------------------- UIFormField field1 = CreateUIFormField(); UIFormField field2 = CreateUIFormField(); UIFormColumn uiFormColumn = new UIFormColumn(); uiFormColumn.Add(field1); uiFormColumn.Add(field2); uiFormColumn.Width = 44; //---------------Execute Test ---------------------- IUIFormColumn clonedFormColumn = uiFormColumn.Clone(); //---------------Test Result ----------------------- Assert.IsTrue(uiFormColumn == (UIFormColumn)clonedFormColumn); Assert.IsTrue(uiFormColumn.Equals(clonedFormColumn)); Assert.AreSame(uiFormColumn[0], clonedFormColumn[0]); }
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 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 void TestGetRowsRequired() { //---------------Set up test pack------------------- UIFormField field1 = CreateUIFormField("label1", "prop1"); Hashtable parameters = new Hashtable(); parameters.Add("rowSpan", 2); UIFormField field2 = CreateUIFormField("label2", "prop2", parameters); UIFormColumn uiFormColumn = new UIFormColumn(); uiFormColumn.Add(field1); uiFormColumn.Add(field2); //---------------Assert Precondition---------------- Assert.AreEqual(2, uiFormColumn.Count); //---------------Execute Test ---------------------- int rowsRequired = uiFormColumn.GetRowsRequired(); //---------------Test Result ----------------------- Assert.AreEqual(3, rowsRequired); }
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 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 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 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 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 GetRowSpanForColumnToTheRight_None() { //---------------Set up test pack------------------- Hashtable parameters = new Hashtable(); parameters.Add("rowSpan", 2); UIFormField field2 = CreateUIFormField("label2", "prop2"); UIFormColumn uiFormColumn = new UIFormColumn(); uiFormColumn.Add(field2); //---------------Execute Test ---------------------- int rowsPanForColumnToTheRight = uiFormColumn.GetRowSpanForColumnToTheRight(1); //---------------Test Result ----------------------- Assert.AreEqual(0, rowsPanForColumnToTheRight); }
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); }