示例#1
0
        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]);
        }
示例#2
0
        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));
        }
示例#3
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]);
        }
示例#4
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);

        }
示例#5
0
        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);
        }
示例#6
0
        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);
        }
示例#7
0
        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);
        }
示例#8
0
        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 -------------------------          
        }
示例#9
0
        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 -------------------------          
        }
示例#10
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;
        }
示例#11
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;
 }
示例#12
0
 private UIFormTab CreateUIFormTab()
 {
     UIFormTab uiFormTab1 = new UIFormTab();
     UIFormColumn uiFormColumn = CreateUIFormColumn_2Fields();
     uiFormTab1.Add(uiFormColumn);
     return uiFormTab1;
 }
示例#13
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;
 }
示例#14
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);
 }
示例#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]);
        }
示例#16
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;
            }
示例#17
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;
 }
示例#18
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;
 }
示例#19
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)");
        }
示例#20
0
        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);
        }
示例#21
0
        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);
        }
示例#22
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;
 }