Exemple #1
0
        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 -------------------------
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        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]);
        }
Exemple #7
0
        public UIFormColumn CreateUIFormColumn_1Field(string propName)
        {
            UIFormColumn uiFormColumn = new UIFormColumn();

            uiFormColumn.Add(CreateUIFormField("label1", propName, null));
            return(uiFormColumn);
        }
Exemple #8
0
        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));
        }
Exemple #9
0
        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));
        }
Exemple #10
0
        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]);
        }
Exemple #11
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);
        }
Exemple #12
0
        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);
        }
Exemple #13
0
        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);
        }
Exemple #14
0
        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);
        }
Exemple #15
0
        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]);
        }
Exemple #16
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));
        }
Exemple #17
0
        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)");
        }
Exemple #18
0
        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));
        }
Exemple #19
0
        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);
        }
Exemple #20
0
        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);
        }