Пример #1
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]);
        }
Пример #2
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));
        }
Пример #3
0
        ///<summary>
        /// Clones the collection.
        ///</summary>
        ///<returns>a new collection that is a shallow copy of this collection</returns>
        public IUIFormColumn Clone()
        {
            UIFormColumn newPropDefCol = new UIFormColumn();

            newPropDefCol.Width = this.Width;
            foreach (UIFormField def in this)
            {
                newPropDefCol.Add(def);
            }
            return(newPropDefCol);
        }
Пример #4
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)");
        }
Пример #5
0
 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;
 }
Пример #6
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]);

        }
Пример #7
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);
 }
Пример #8
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);

        }
Пример #9
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 -------------------------          
        }
Пример #10
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);
 }
Пример #11
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]);
        }
Пример #12
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;
            }
Пример #13
0
 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;
 }
Пример #14
0
 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;
 }
Пример #15
0
 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;
 }
Пример #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));
 }
Пример #17
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));

        }
Пример #18
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;
 }
Пример #19
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));

        }
Пример #20
0
 ///<summary>
 /// Clones the collection.
 ///</summary>
 ///<returns>a new collection that is a shallow copy of this collection</returns>
 public IUIFormColumn Clone()
 {
     UIFormColumn newPropDefCol = new UIFormColumn();
     newPropDefCol.Width = this.Width;
     foreach (UIFormField def in this)
     {
         newPropDefCol.Add(def);
     }
     return newPropDefCol;
 }
Пример #21
0
 public void GetRowSpanForColumnToTheRight_One()
 {
     //---------------Set up test pack-------------------
     Hashtable parameters = new Hashtable();
     parameters.Add("rowSpan", 1);
     parameters.Add("colSpan", 2);
     UIFormField field2 = CreateUIFormField("label2", "prop2", parameters); 
     UIFormColumn uiFormColumn = new UIFormColumn();
     uiFormColumn.Add(field2);
     //---------------Execute Test ----------------------
     int rowsPanForColumnToTheRight = uiFormColumn.GetRowSpanForColumnToTheRight(1);
     //---------------Test Result -----------------------
     Assert.AreEqual(1, rowsPanForColumnToTheRight);
 }
Пример #22
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;
 }
Пример #23
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);
 }
Пример #24
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;
 }
Пример #25
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;
        }
Пример #26
0
 public UIFormColumn CreateUIFormColumn_1Field(string propName)
 {
     UIFormColumn uiFormColumn = new UIFormColumn();
     uiFormColumn.Add(CreateUIFormField("label1", propName, null));
     return uiFormColumn;
 }
Пример #27
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;
        }
Пример #28
0
 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;
 }