Beispiel #1
0
        private static ClassDef GetClassDef()
        {
            PropDef       propDefPK     = new PropDef(ENUM_PKPROP_NAME, typeof(Guid), PropReadWriteRule.WriteNew, null);
            PropDef       propDef       = new PropDef(ENUM_PROP_NAME, typeof(TestEnum), PropReadWriteRule.ReadWrite, TestEnum.Option1);
            PropDef       propDef2      = new PropDef(ENUM_PROP_NAME_EMPTY, typeof(TestEnumEmpty), PropReadWriteRule.ReadWrite, null);
            PropDef       propDef3      = new PropDef(ENUM_PROP_NAME_PASCAL, typeof(TestEnumPascalCase), PropReadWriteRule.ReadWrite, null);
            PrimaryKeyDef primaryKeyDef = new PrimaryKeyDef {
                propDefPK
            };
            PropDefCol propDefCol = new PropDefCol {
                propDefPK, propDef, propDef2, propDef3
            };

            UIFormField uiFormField = new UIFormField(TestUtil.GetRandomString(), propDef.PropertyName,
                                                      typeof(IComboBox), "EnumComboBoxMapper", "Habanero.Faces.Base", true, null, null, LayoutStyle.Label);
            UIFormColumn uiFormColumn = new UIFormColumn {
                uiFormField
            };
            UIFormTab uiFormTab = new UIFormTab {
                uiFormColumn
            };
            UIForm uiForm = new UIForm {
                uiFormTab
            };
            UIDef    uiDef    = new UIDef("default", uiForm, null);
            UIDefCol uiDefCol = new UIDefCol {
                uiDef
            };

            ClassDef classDef = new ClassDef(typeof(EnumBO), primaryKeyDef, propDefCol, new KeyDefCol(), null, uiDefCol);

            return(classDef);
        }
Beispiel #2
0
 private void OnRestartClick()
 {
     Time.timeScale = 1;
     UIMgr.Instance.DestroyUI(UIDef.GetLevelName(mCurrentLevel));
     UIMgr.Instance.ShowUI(UIDef.GetLevelName(mCurrentLevel), typeof(LevelMgr), this, mCurrentLevel);
     UIMgr.Instance.DestroyUI(UIDef.DieUI);
 }
Beispiel #3
0
        public void TestContains()
        {
            UIDef    uiDef = new UIDef("defname", null, null);
            UIDefCol col   = new UIDefCol();

            Assert.IsFalse(col.Contains(uiDef));
            col.Add(uiDef);
            Assert.IsTrue(col.Contains(uiDef));
        }
Beispiel #4
0
        public void Test_EqualHasIdenticalUIForm()
        {
            UIForm uiForm  = GetUiForm();
            UIForm uiForm2 = GetUiForm();
            UIDef  uiDef   = new UIDef("DDD", uiForm, null);
            UIDef  uiDef2  = new UIDef("DDD", uiForm2, null);

            AssertAreEqual(uiDef, uiDef2);
        }
Beispiel #5
0
    private void OnMenuClick()
    {
        MusicManager.Instance.StopBGM();
        UIMgr.Instance.DestroyUI(UIDef.GetLevelName(mCurrentLevel));
        UIMgr.Instance.DestroyUI(UIDef.DieUI);
        UIMgr.Instance.DestroyUI(UIDef.WinUI);

        UIMgr.Instance.ShowUI(UIDef.SelectLevelUI, typeof(SelectLevelCtrl), this);
    }
Beispiel #6
0
        public void Test_NotEqual_DiffName()
        {
            UIDef uiDef  = new UIDef("DDD", null, null);
            UIDef uiDef2 = new UIDef("DDD_1", null, null);

            Assert.IsFalse(uiDef.Equals(uiDef2));
            Assert.IsFalse(uiDef == uiDef2);
            Assert.IsTrue(uiDef != uiDef2);
        }
Beispiel #7
0
        public void TestContains()
        {
            UIDef uiDef = new UIDef("defname", null, null);
            UIDefCol col = new UIDefCol();

            Assert.IsFalse(col.Contains(uiDef));
            col.Add(uiDef);
            Assert.IsTrue(col.Contains(uiDef));
        }
Beispiel #8
0
        public void Test_NotEqualsNull()
        {
            UIDef uiDef  = new UIDef("", null, null);
            UIDef uiDef2 = null;

            Assert.IsFalse(uiDef.Equals(uiDef2));
            Assert.IsFalse(uiDef == uiDef2);
            Assert.IsTrue(uiDef != uiDef2);
            Assert.AreNotEqual(uiDef, uiDef2);
        }
Beispiel #9
0
        public void Test_EqualHasTheSameUIForm()
        {
            UIForm uiForm = GetUiForm();
            UIDef  uiDef  = new UIDef("DDD", uiForm, null);
            UIDef  uiDef2 = new UIDef("DDD", uiForm, null);

            Assert.IsTrue(uiDef.Equals(uiDef2));
            Assert.IsTrue(uiDef == uiDef2);
            Assert.IsFalse(uiDef != uiDef2);
        }
Beispiel #10
0
        /// <summary>
        /// Level seleccionado
        /// </summary>
        public void SelectLevel()
        {
            if (Imagelock.gameObject.activeSelf)
            {
                return;
            }

            AppMgr.Instance.HeroPos = Vector3.zero;

            UIMgr.Instance.ShowUI(UIDef.GetLevelName(level), typeof(LevelMgr), SelectLevelCtrl.Instance, level);
        }
Beispiel #11
0
        public void Test_NonEqualHasNonEqualUIForm()
        {
            UIForm uiForm  = GetUiForm();
            UIForm uiForm2 = GetUiForm();

            uiForm2.Title = "DifferentTitle";
            UIDef uiDef  = new UIDef("DDD", uiForm, null);
            UIDef uiDef2 = new UIDef("DDD", uiForm2, null);

            AssertNotEqual(uiDef, uiDef2);
        }
Beispiel #12
0
 public void Test_UIForm_WhenSet_ShouldSetUIDef()
 {
     //---------------Set up test pack-------------------
     IUIForm uiForm = MockRepository.GenerateStub<IUIForm>();
     UIDef uiDef = new UIDef("test", null, null);
     //---------------Assert Precondition----------------
     Assert.IsNull(uiForm.UIDef);
     //---------------Execute Test ----------------------
     uiDef.UIForm = uiForm;
     //---------------Test Result -----------------------
     Assert.AreSame(uiDef, uiForm.UIDef);
 }
Beispiel #13
0
        public void Test_Construct_ShouldSetUIDefOnUIGrid()
        {
            //---------------Set up test pack-------------------
            UIGrid uiGrid = new UIGrid();

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            UIDef uiDef = new UIDef("test", null, uiGrid);

            //---------------Test Result -----------------------
            Assert.AreSame(uiDef, uiGrid.UIDef);
        }
Beispiel #14
0
        public void Test_Construct_ShouldSetUIDefOnUIForm()
        {
            //---------------Set up test pack-------------------
            UIForm uiForm = new UIForm();

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            UIDef uiDef = new UIDef("test", uiForm, null);

            //---------------Test Result -----------------------
            Assert.AreSame(uiDef, uiForm.UIDef);
        }
Beispiel #15
0
 /// <summary>
 /// 初始化UI主要用于寻找组件等
 /// </summary>
 public void UIInit()
 {
     if (mainCanvas == null)
     {
         mainCanvas = this.GetComponent <Canvas>();
     }
     if (mainCanvas != null)
     {
         mainCanvas.worldCamera = AppMgr.Instance.MainCamera;
     }
     mainCanvas.sortingOrder = UIDef.GetUIOrderLayer(UIName);
     OnInit();
 }
Beispiel #16
0
        public void Test_Construct_ShouldSetUIDefOnUIForm()
        {
            //---------------Set up test pack-------------------
            UIForm uiForm = new UIForm();

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            UIDef uiDef = new UIDef("test", uiForm, null);

            //---------------Test Result -----------------------
            Assert.AreSame(uiDef, uiForm.UIDef);
        }
Beispiel #17
0
        public void Test_UIForm_WhenSet_ShouldSetUIDef()
        {
            //---------------Set up test pack-------------------
            IUIForm uiForm = MockRepository.GenerateStub <IUIForm>();
            UIDef   uiDef  = new UIDef("test", null, null);

            //---------------Assert Precondition----------------
            Assert.IsNull(uiForm.UIDef);
            //---------------Execute Test ----------------------
            uiDef.UIForm = uiForm;
            //---------------Test Result -----------------------
            Assert.AreSame(uiDef, uiForm.UIDef);
        }
Beispiel #18
0
        public void Test_ClassName_WhenClassDefNull_ShouldReturnEmptyString()
        {
            //---------------Set up test pack-------------------
            UIDef uiDef = new UIDef("test", null, null);

            //---------------Assert Precondition----------------
            Assert.IsNull(uiDef.ClassDef);
            //---------------Execute Test ----------------------
            string className = uiDef.ClassName;

            //---------------Test Result -----------------------
            Assert.IsEmpty(className);
        }
Beispiel #19
0
        public void Test_NonEqualHasNonEqualUIGrid()
        {
            UIGrid uiGrid = new UIGrid();

            uiGrid.SortColumn = "sort 1";
            UIGrid uiGrid2 = new UIGrid();

            uiGrid2.SortColumn = "Sort Another";
            UIDef uiDef  = new UIDef("DDD", null, uiGrid);
            UIDef uiDef2 = new UIDef("DDD", null, uiGrid2);

            AssertNotEqual(uiDef, uiDef2);
        }
Beispiel #20
0
        public void Test_Construct_ShouldSetUIDefOnUIGrid()
        {
            //---------------Set up test pack-------------------
            UIGrid uiGrid = new UIGrid();

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            UIDef uiDef = new UIDef("test", null, uiGrid);

            //---------------Test Result -----------------------
            Assert.AreSame(uiDef, uiGrid.UIDef);
        }
Beispiel #21
0
        public void Test_SetClassDef_WhenNoUIFormDef_ShouldNotRaiseError()
        {
            //---------------Set up test pack-------------------
            var uiDef    = new UIDef("test", null, null);
            var classDef = MockRepository.GenerateStub <IClassDef>();

            //---------------Assert Precondition----------------
            Assert.IsNull(uiDef.UIForm);
            //---------------Execute Test ----------------------
            uiDef.ClassDef = classDef;
            //---------------Test Result -----------------------
            Assert.AreSame(classDef, uiDef.ClassDef);
        }
Beispiel #22
0
        public void TestUIDefCol()
        {
            //---------------Set up test pack-------------------
            UIDef    uiDef    = new UIDef("test", null, null);
            UIDefCol uiDefCol = new UIDefCol();

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            uiDef.UIDefCol = uiDefCol;
            //---------------Test Result -----------------------
            Assert.AreSame(uiDefCol, uiDef.UIDefCol);
        }
Beispiel #23
0
        public void Test_NotEqual_OtherType()
        {
            //---------------Set up test pack-------------------
            UIDef uiDef = new UIDef("", null, null);

            //--------------Assert PreConditions----------------

            //---------------Execute Test ----------------------

            Assert.IsFalse(uiDef.Equals("BNLJ JOLJ"));
            //---------------Test Result -----------------------

            //---------------Tear Down -------------------------
        }
 // Creates a new UI def by cloning an existing one and adding a cloned column
 //   (easier than creating a whole new BO for this test)
 private static IClassDef GetCustomClassDef()
 {
     IClassDef classDef = ClassDef.Get<MyBO>();
     IUIGrid originalGridDef = classDef.UIDefCol["default"].UIGrid;
     UIGrid extraGridDef = ((UIGrid)originalGridDef).Clone();
     //UIGridColumn extraColumn = originalGridDef[0].Clone();
     //extraGridDef.Add(extraColumn);
     extraGridDef.Remove(extraGridDef[extraGridDef.Count - 1]);
     //UIGridColumn extraColumn = new UIGridColumn("HABANERO_OBJECTID", "ProjectAssemblyInfoID", typeof(System.Windows.Forms.DataGridViewTextBoxColumn), true, 100, UIGridColumn.PropAlignment.right, null);
     //extraGridDef.Add(extraColumn);
     UIDef extraUIDef = new UIDef(CUSTOM_UIDEF_NAME, null, extraGridDef);
     classDef.UIDefCol.Add(extraUIDef);
     return classDef;
 }
Beispiel #25
0
        public void Test_UIForm_WhenChanged_ShouldResetUIDefOnOld()
        {
            //---------------Set up test pack-------------------
            IUIForm uiFormOld = MockRepository.GenerateStub <IUIForm>();
            IUIForm uiFormNew = MockRepository.GenerateStub <IUIForm>();
            UIDef   uiDef     = new UIDef("test", uiFormOld, null);

            //---------------Assert Precondition----------------
            Assert.AreSame(uiDef, uiFormOld.UIDef);
            //---------------Execute Test ----------------------
            uiDef.UIForm = uiFormNew;
            //---------------Test Result -----------------------
            Assert.IsNull(uiFormOld.UIDef);
        }
Beispiel #26
0
        public void TestEquals_SameUIDef()
        {
            //---------------Execute Test ----------------------
            UIDefCol uIDefCol1 = new UIDefCol();
            UIDef    def       = new UIDef("UiDefname", null, null);

            uIDefCol1.Add(def);
            UIDefCol uIDefCol2 = new UIDefCol();

            uIDefCol2.Add(def);
            //---------------Test Result -----------------------
            AssertAreEqual(uIDefCol1, uIDefCol2);
//            Assert.AreEqual(uIDefCol1, uIDefCol2);
        }
Beispiel #27
0
        public void Test_NotEqual_DifferentCount()
        {
            UIDefCol uIDefCol1 = new UIDefCol();
            UIDef    def       = new UIDef("UiDefname", null, null);

            uIDefCol1.Add(def);
            UIDefCol uIDefCol2 = new UIDefCol();

            uIDefCol2.Add(def);
            UIDef def2 = new UIDef("UiDefname2", null, null);

            uIDefCol2.Add(def2);
            AssertNotEqual(uIDefCol1, uIDefCol2);
        }
Beispiel #28
0
        public void WhenChanged_ButOldDoesNotLink_ShouldNotResetUIDefOnOld()
        {
            //---------------Set up test pack-------------------
            IUIGrid uiGridOld = MockRepository.GenerateStub <IUIGrid>();
            IUIGrid uiGridNew = MockRepository.GenerateStub <IUIGrid>();
            UIDef   uiDef     = new UIDef("test", null, uiGridOld);

            uiGridOld.UIDef = MockRepository.GenerateStub <IUIDef>();
            //---------------Assert Precondition----------------
            Assert.AreNotSame(uiDef, uiGridOld.UIDef);
            //---------------Execute Test ----------------------
            uiDef.UIGrid = uiGridNew;
            //---------------Test Result -----------------------
            Assert.IsNotNull(uiGridOld.UIDef);
        }
        protected static IClassDef GetCustomClassDef()
        {
            ClassDef.ClassDefs.Clear();
            ContactPersonTestBO.LoadClassDef_NoOrganisationRelationship();
            IClassDef classDef        = OrganisationTestBO.LoadDefaultClassDef();
            IUIGrid   originalGridDef = classDef.UIDefCol["default"].UIGrid;
            UIGrid    extraGridDef    = ((UIGrid)originalGridDef).Clone();

            extraGridDef.Remove(extraGridDef[extraGridDef.Count - 1]);
            UIDef extraUIDef     = new UIDef(CUSTOM_UIDEF_NAME, new UIForm(), extraGridDef);
            UIDef gridWithNoForm = new UIDef(GRID_WITHNOFORM, null, extraGridDef);

            classDef.UIDefCol.Add(extraUIDef);
            return(classDef);
        }
Beispiel #30
0
    private void OnNextClick()
    {
        MusicManager.Instance.StopBGM();
        UIMgr.Instance.DestroyUI(UIDef.GetLevelName(mCurrentLevel));
        UIMgr.Instance.DestroyUI(UIDef.DieUI);
        UIMgr.Instance.DestroyUI(UIDef.WinUI);

        if (mCurrentLevel != 2)
        {
            UIMgr.Instance.ShowUI(UIDef.GetLevelName(mCurrentLevel + 1), typeof(LevelMgr), this, mCurrentLevel + 1);
        }
        else
        {
            UIMgr.Instance.ShowUI(UIDef.SelectLevelUI, typeof(SelectLevelCtrl), this);
        }
    }
Beispiel #31
0
        public void TestCloneUIFormNull()
        {
            //---------------Set up test pack-------------------
            UIDef uiDef = new UIDef("Name", null, GetUiGrid());
            //--------------Assert PreConditions----------------            

            //---------------Execute Test ----------------------
            IUIDef clonedDef = uiDef.Clone();
            //---------------Test Result -----------------------
            Assert.IsTrue(uiDef == (UIDef) clonedDef);
            Assert.IsTrue(uiDef.Equals(clonedDef));
            Assert.AreNotSame(uiDef, clonedDef);

            Assert.AreSame(null, clonedDef.UIForm);
            Assert.AreNotSame(uiDef.UIGrid, clonedDef.UIGrid);
            //---------------Tear Down -------------------------          
        }
Beispiel #32
0
        public void TestEnumerator()
        {
            UIDef    uiDef1 = new UIDef("defname1", null, null);
            UIDef    uiDef2 = new UIDef("defname2", null, null);
            UIDefCol col    = new UIDefCol();

            col.Add(uiDef1);
            col.Add(uiDef2);

            int count = 0;

            foreach (object def in col)
            {
                count++;
            }
            Assert.AreEqual(2, count);
        }
Beispiel #33
0
        public void Test_HashCode_Equals()
        {
            //--------------- Set up test pack ------------------
            UIDefCol uIDefCol1 = new UIDefCol();
            UIDef    def       = new UIDef("UiDefname", null, null);

            uIDefCol1.Add(def);
            UIDefCol uIDefCol2 = new UIDefCol();

            uIDefCol2.Add(def);
            //--------------- Test Preconditions ----------------
            AssertAreEqual(uIDefCol1, uIDefCol2);
            //--------------- Execute Test ----------------------

            //--------------- Test Result -----------------------
            Assert.AreEqual(uIDefCol1.GetHashCode(), uIDefCol2.GetHashCode());
        }
Beispiel #34
0
        public void Test_SetClassDef_ShouldSetClassDefOnRelatedFormDef()
        {
            //---------------Set up test pack-------------------
            var uiForm = new UIForm();
            var uiDef  = new UIDef("test", null, null)
            {
                UIForm = uiForm
            };
            var classDef = MockRepository.GenerateStub <IClassDef>();

            //---------------Assert Precondition----------------
            Assert.IsNull(uiForm.ClassDef);
            //---------------Execute Test ----------------------
            uiDef.ClassDef = classDef;
            //---------------Test Result -----------------------
            Assert.AreSame(classDef, uiForm.ClassDef);
        }
Beispiel #35
0
        public void Test_ClassName_WhenClassDefSet_ShouldReturnClassDefClassName()
        {
            //---------------Set up test pack-------------------
            IUIDef uiDef    = new UIDef("test", null, null);
            var    classDef = MockRepository.GenerateStub <IClassDef>();

            classDef.ClassName = GetRandomString();
            uiDef.ClassDef     = classDef;
            //---------------Assert Precondition----------------
            Assert.IsNotNull(uiDef.ClassDef);
            Assert.IsNotNullOrEmpty(classDef.ClassName);
            //---------------Execute Test ----------------------
            string className = uiDef.ClassName;

            //---------------Test Result -----------------------
            Assert.AreSame(classDef.ClassName, className);
        }
Beispiel #36
0
        public void TestCloneUIFormNull()
        {
            //---------------Set up test pack-------------------
            UIDef uiDef = new UIDef("Name", null, GetUiGrid());
            //--------------Assert PreConditions----------------

            //---------------Execute Test ----------------------
            IUIDef clonedDef = uiDef.Clone();

            //---------------Test Result -----------------------
            Assert.IsTrue(uiDef == (UIDef)clonedDef);
            Assert.IsTrue(uiDef.Equals(clonedDef));
            Assert.AreNotSame(uiDef, clonedDef);

            Assert.AreSame(null, clonedDef.UIForm);
            Assert.AreNotSame(uiDef.UIGrid, clonedDef.UIGrid);
            //---------------Tear Down -------------------------
        }
Beispiel #37
0
        public void TestAddDuplicateNameException()
        {
            //---------------Set up test pack-------------------
            UIDef uiDef1 = new UIDef("defname", null, null);
            UIDef uiDef2 = new UIDef("defname", null, null);
            UIDefCol col = new UIDefCol();
            col.Add(uiDef1);
            //---------------Execute Test ----------------------
            try
            {
                col.Add(uiDef2);

                Assert.Fail("Expected to throw an InvalidXmlDefinitionException");
            }
                //---------------Test Result -----------------------
            catch (InvalidXmlDefinitionException ex)
            {
                StringAssert.Contains("a definition with that name already exists", ex.Message);
            }
        }
Beispiel #38
0
 private static void AssertNotEqual(UIDef uiDef, UIDef uiDef2)
 {
     Assert.IsFalse(uiDef.Equals(uiDef2));
     Assert.IsFalse(uiDef == uiDef2);
     Assert.IsTrue(uiDef != uiDef2);
 }
Beispiel #39
0
 public void Test_UIForm_WhenChanged_ShouldResetUIDefOnOld()
 {
     //---------------Set up test pack-------------------
     IUIForm uiFormOld = MockRepository.GenerateStub<IUIForm>();
     IUIForm uiFormNew = MockRepository.GenerateStub<IUIForm>();
     UIDef uiDef = new UIDef("test", uiFormOld, null);
     //---------------Assert Precondition----------------
     Assert.AreSame(uiDef, uiFormOld.UIDef);
     //---------------Execute Test ----------------------
     uiDef.UIForm = uiFormNew;
     //---------------Test Result -----------------------
     Assert.IsNull(uiFormOld.UIDef);
 }
Beispiel #40
0
 public void Test_SetClassDef_ShouldSetClassDefOnRelatedFormDef()
 {
     //---------------Set up test pack-------------------
     var uiForm = new UIForm();
     var uiDef = new UIDef("test", null, null) {UIForm = uiForm};
     var classDef = MockRepository.GenerateStub<IClassDef>();
     //---------------Assert Precondition----------------
     Assert.IsNull(uiForm.ClassDef);
     //---------------Execute Test ----------------------
     uiDef.ClassDef = classDef;
     //---------------Test Result -----------------------
     Assert.AreSame(classDef, uiForm.ClassDef);
 }
        private static ClassDef GetClassDef()
        {
            PropDef propDefPK = new PropDef(ENUM_PKPROP_NAME, typeof(Guid), PropReadWriteRule.WriteNew, null);
            PropDef propDef = new PropDef(ENUM_PROP_NAME, typeof(TestEnum), PropReadWriteRule.ReadWrite, TestEnum.Option1);
            PropDef propDef2 = new PropDef(ENUM_PROP_NAME_EMPTY, typeof(TestEnumEmpty), PropReadWriteRule.ReadWrite, null);
            PropDef propDef3 = new PropDef(ENUM_PROP_NAME_PASCAL, typeof(TestEnumPascalCase), PropReadWriteRule.ReadWrite, null);
            PrimaryKeyDef primaryKeyDef = new PrimaryKeyDef { propDefPK };
            PropDefCol propDefCol = new PropDefCol { propDefPK, propDef, propDef2, propDef3 };

            UIFormField uiFormField = new UIFormField(TestUtil.GetRandomString(), propDef.PropertyName,
                                                      typeof(IComboBox), "EnumComboBoxMapper", "Habanero.Faces.Base", true, null, null, LayoutStyle.Label);
            UIFormColumn uiFormColumn = new UIFormColumn { uiFormField };
            UIFormTab uiFormTab = new UIFormTab { uiFormColumn };
            UIForm uiForm = new UIForm { uiFormTab };
            UIDef uiDef = new UIDef("default", uiForm, null);
            UIDefCol uiDefCol = new UIDefCol { uiDef };

            ClassDef classDef = new ClassDef(typeof(EnumBO), primaryKeyDef, propDefCol, new KeyDefCol(), null, uiDefCol);
            return classDef;
        }
Beispiel #42
0
 public void Test_NotEqualsNull()
 {
     UIDef uiDef = new UIDef("", null, null);
     UIDef uiDef2 = null;
     Assert.IsFalse(uiDef.Equals(uiDef2));
     Assert.IsFalse(uiDef == uiDef2);
     Assert.IsTrue(uiDef != uiDef2);
     Assert.AreNotEqual(uiDef, uiDef2);
 }
Beispiel #43
0
        public void Test_NotEqual_DifferentDefs()
        {
            UIDefCol uIDefCol1 = new UIDefCol();
            UIDef def = new UIDef("UiDefname", null, null);
            uIDefCol1.Add(def);
            UIDefCol uIDefCol2 = new UIDefCol();
            uIDefCol2.Add(def);
            UIDef def2 = new UIDef("UiDefname2", null, null);
            uIDefCol2.Add(def2);

            UIDef def3 = new UIDef("UiDefname3", null, null);
            uIDefCol1.Add(def3);

            AssertNotEqual(uIDefCol1, uIDefCol2);
        }
 protected static IClassDef GetCustomClassDef()
 {
     ClassDef.ClassDefs.Clear();
     ContactPersonTestBO.LoadClassDef_NoOrganisationRelationship();
     IClassDef classDef = OrganisationTestBO.LoadDefaultClassDef();
     IUIGrid originalGridDef = classDef.UIDefCol["default"].UIGrid;
     UIGrid extraGridDef = ((UIGrid)originalGridDef).Clone();
     extraGridDef.Remove(extraGridDef[extraGridDef.Count - 1]);
     UIDef extraUIDef = new UIDef(CUSTOM_UIDEF_NAME, new UIForm(), extraGridDef);
     UIDef gridWithNoForm = new UIDef(GRID_WITHNOFORM, null, extraGridDef);
     classDef.UIDefCol.Add(extraUIDef);
     return classDef;
 }
Beispiel #45
0
        public void Test_NotEqual_UIFormDifferent()
        {
            //---------------Set up test pack-------------------

            UIForm uiForm = GetUiForm();

            UIDef uiDef = new UIDef("DDD", uiForm, null);
            UIDef uiDef2 = new UIDef("DDD", null, null);
            //--------------Assert PreConditions----------------            

            //---------------Execute Test ----------------------


            //---------------Test Result -----------------------

            Assert.IsFalse(uiDef.Equals(uiDef2));
            Assert.IsFalse(uiDef == uiDef2);
            Assert.IsTrue(uiDef != uiDef2);
            //---------------Tear Down -------------------------          
        }
Beispiel #46
0
        public void Test_NotEqual_DiffName()
        {
            UIDef uiDef = new UIDef("DDD", null, null);
            UIDef uiDef2 = new UIDef("DDD_1", null, null);

            Assert.IsFalse(uiDef.Equals(uiDef2));
            Assert.IsFalse(uiDef == uiDef2);
            Assert.IsTrue(uiDef != uiDef2);
        }
Beispiel #47
0
        public void Test_HashCode_NotEquals()
        {
            //--------------- Set up test pack ------------------
            UIDefCol uIDefCol1 = new UIDefCol();
            UIDef def = new UIDef("UiDefname", null, null);
            UIDef def2 = new UIDef("UiDefName2", null, null);
            uIDefCol1.Add(def);
            UIDefCol uIDefCol2 = new UIDefCol();
            uIDefCol2.Add(def2);
            //--------------- Test Preconditions ----------------
            AssertNotEqual(uIDefCol1, uIDefCol2);
            //--------------- Execute Test ----------------------

            //--------------- Test Result -----------------------
            Assert.AreNotEqual(uIDefCol1.GetHashCode(), uIDefCol2.GetHashCode());
        }
Beispiel #48
0
        public void TestUIDefCol()
        {
            //---------------Set up test pack-------------------
            UIDef uiDef = new UIDef("test", null, null);
            UIDefCol uiDefCol = new UIDefCol();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            uiDef.UIDefCol = uiDefCol;
            //---------------Test Result -----------------------
            Assert.AreSame(uiDefCol, uiDef.UIDefCol);

        }
Beispiel #49
0
 public void Test_ClassName_WhenClassDefNull_ShouldReturnEmptyString()
 {
     //---------------Set up test pack-------------------
     UIDef uiDef = new UIDef("test", null, null);
     //---------------Assert Precondition----------------
     Assert.IsNull(uiDef.ClassDef);
     //---------------Execute Test ----------------------
     string className = uiDef.ClassName;
     //---------------Test Result -----------------------
     Assert.IsEmpty(className);
 }
Beispiel #50
0
 public void WhenChanged_ButOldDoesNotLink_ShouldNotResetUIDefOnOld()
 {
     //---------------Set up test pack-------------------
     IUIGrid uiGridOld = MockRepository.GenerateStub<IUIGrid>();
     IUIGrid uiGridNew = MockRepository.GenerateStub<IUIGrid>();
     UIDef uiDef = new UIDef("test", null, uiGridOld);
     uiGridOld.UIDef = MockRepository.GenerateStub<IUIDef>();
     //---------------Assert Precondition----------------
     Assert.AreNotSame(uiDef, uiGridOld.UIDef);
     //---------------Execute Test ----------------------
     uiDef.UIGrid = uiGridNew;
     //---------------Test Result -----------------------
     Assert.IsNotNull(uiGridOld.UIDef);
 }
Beispiel #51
0
        public void Test_EqualHasIdenticalUIForm()
        {
            UIForm uiForm = GetUiForm();
            UIForm uiForm2 = GetUiForm();
            UIDef uiDef = new UIDef("DDD", uiForm, null);
            UIDef uiDef2 = new UIDef("DDD", uiForm2, null);

            AssertAreEqual(uiDef, uiDef2);
        }
Beispiel #52
0
        public void TestEquals_SameUIDef()
        {
            //---------------Execute Test ----------------------
            UIDefCol uIDefCol1 = new UIDefCol();
            UIDef def = new UIDef("UiDefname", null, null);
            uIDefCol1.Add(def);
            UIDefCol uIDefCol2 = new UIDefCol();
            uIDefCol2.Add(def);
            //---------------Test Result -----------------------
            AssertAreEqual(uIDefCol1, uIDefCol2);
//            Assert.AreEqual(uIDefCol1, uIDefCol2);
        }
Beispiel #53
0
        public void Test_EqualHasTheSameUIForm()
        {
            UIForm uiForm = GetUiForm();
            UIDef uiDef = new UIDef("DDD", uiForm, null);
            UIDef uiDef2 = new UIDef("DDD", uiForm, null);

            Assert.IsTrue(uiDef.Equals(uiDef2));
            Assert.IsTrue(uiDef == uiDef2);
            Assert.IsFalse(uiDef != uiDef2);
        }
Beispiel #54
0
        public void Test_NonEqualHasNonEqualUIGrid()
        {
            UIGrid uiGrid = new UIGrid();
            uiGrid.SortColumn = "sort 1";
            UIGrid uiGrid2 = new UIGrid();
            uiGrid2.SortColumn = "Sort Another";
            UIDef uiDef = new UIDef("DDD", null, uiGrid);
            UIDef uiDef2 = new UIDef("DDD", null, uiGrid2);

            AssertNotEqual(uiDef, uiDef2);
        }
Beispiel #55
0
        public void Test_NotEqual_OtherType()
        {
            //---------------Set up test pack-------------------
            UIDef uiDef = new UIDef("", null, null);
            //--------------Assert PreConditions----------------            

            //---------------Execute Test ----------------------

            Assert.IsFalse(uiDef.Equals("BNLJ JOLJ"));
            //---------------Test Result -----------------------

            //---------------Tear Down -------------------------          
        }
Beispiel #56
0
        public void TestEnumerator()
        {
            UIDef uiDef1 = new UIDef("defname1", null, null);
            UIDef uiDef2 = new UIDef("defname2", null, null);
            UIDefCol col = new UIDefCol();
            col.Add(uiDef1);
            col.Add(uiDef2);

            int count = 0;
            foreach (object def in col)
            {
                count++;
            }
            Assert.AreEqual(2, count);
        }
Beispiel #57
0
        public void TestCloneUIDef()
        {
            //---------------Set up test pack-------------------
            UIForm uiForm = GetUiForm();

            UIGrid uiGrid = GetUiGrid();

            UIDef uiDef = new UIDef("Name", uiForm, uiGrid);
            //---------------Execute Test ----------------------
            IUIDef clonedDef = uiDef.Clone();

            //---------------Test Result -----------------------
            Assert.IsTrue(uiDef == (UIDef) clonedDef);
            Assert.IsTrue(uiDef.Equals(clonedDef));
            Assert.AreNotSame(uiDef, clonedDef);

            Assert.AreNotSame(uiDef.UIForm, clonedDef.UIForm);
            Assert.AreNotSame(uiDef.UIGrid, clonedDef.UIGrid);
        }
Beispiel #58
0
        public void Test_NonEqualHasNonEqualUIForm()
        {
            UIForm uiForm = GetUiForm();
            UIForm uiForm2 = GetUiForm();
            uiForm2.Title = "DifferentTitle";
            UIDef uiDef = new UIDef("DDD", uiForm, null);
            UIDef uiDef2 = new UIDef("DDD", uiForm2, null);

            AssertNotEqual(uiDef, uiDef2);
        }
Beispiel #59
0
 public void Test_ClassName_WhenClassDefSet_ShouldReturnClassDefClassName()
 {
     //---------------Set up test pack-------------------
     IUIDef uiDef = new UIDef("test", null, null);
     var classDef = MockRepository.GenerateStub<IClassDef>();
     classDef.ClassName = GetRandomString();
     uiDef.ClassDef = classDef;
     //---------------Assert Precondition----------------
     Assert.IsNotNull(uiDef.ClassDef);
     Assert.IsNotNullOrEmpty(classDef.ClassName);
     //---------------Execute Test ----------------------
     string className = uiDef.ClassName;
     //---------------Test Result -----------------------
     Assert.AreSame(classDef.ClassName, className);
 }
Beispiel #60
0
 public void Test_SetClassDef_WhenNoUIFormDef_ShouldNotRaiseError()
 {
     //---------------Set up test pack-------------------
     var uiDef = new UIDef("test", null, null);
     var classDef = MockRepository.GenerateStub<IClassDef>();
     //---------------Assert Precondition----------------
     Assert.IsNull(uiDef.UIForm);
     //---------------Execute Test ----------------------
     uiDef.ClassDef = classDef;
     //---------------Test Result -----------------------
     Assert.AreSame(classDef, uiDef.ClassDef);
 }