Beispiel #1
0
        public void Test_SetBusinessObject()
        {
            //--------------- Set up test pack ------------------
            ExtendedTextBoxMapper mapper = CreateExtendedLookupComboBoxMapper("TestProp");

            //--------------- Test Preconditions ----------------
            Assert.IsNull(mapper.BusinessObject);
            Assert.IsNull(mapper.BusinessObject);
            MyBO.LoadClassDefWithBOLookup();
            MyBO myBO = new MyBO();

            //--------------- Execute Test ----------------------
            mapper.BusinessObject = myBO;
            //--------------- Test Result -----------------------
            Assert.AreSame(myBO, mapper.BusinessObject);
            Assert.AreSame(myBO, mapper.BusinessObject);
        }
Beispiel #2
0
        public void Test_GetPropertyValueToDisplay_BusinessObjectLookupList_NotInList()
        {
            ContactPersonTestBO.DeleteAllContactPeople();
            ContactPersonTestBO.CreateSampleData();
            ClassDef.ClassDefs.Clear();
            IClassDef classDef = MyBO.LoadClassDefWithBOLookup("Surname <> abc");

            ContactPersonTestBO.LoadDefaultClassDef();

            Criteria            criteria = new Criteria("Surname", Criteria.ComparisonOp.Equals, "abc");
            ContactPersonTestBO cp       = BORegistry.DataAccessor.BusinessObjectLoader.GetBusinessObject <ContactPersonTestBO>(criteria);
            BusinessObject      bo       = (BusinessObject)classDef.CreateNewBusinessObject();

            bo.SetPropertyValue("TestProp2", cp);
            Assert.AreEqual(cp.ContactPersonID, bo.GetPropertyValue("TestProp2"));
            Assert.IsNotNull(bo.GetPropertyValueToDisplay("TestProp2"));
            Assert.AreEqual("abc", bo.GetPropertyValueToDisplay("TestProp2").ToString());
        }
Beispiel #3
0
        public void Test_WhenSetThePropertyToABusinessObject_ShouldSetThePrimaryKey()
        {
            //---------------Set up test pack-------------------
            ClassDef.ClassDefs.Clear();
            var classDef = MyBO.LoadClassDefWithBOLookup();

            ContactPersonTestBO.LoadDefaultClassDef();
            var          cp = new ContactPersonTestBO();
            const string expectedSurname = "abc";

            cp.Surname = expectedSurname;
            var myBO = (BusinessObject)classDef.CreateNewBusinessObject();

            //---------------Assert Precondition----------------
            Assert.AreEqual(expectedSurname, cp.ToString());
            //---------------Execute Test ----------------------
            myBO.SetPropertyValue("TestProp2", cp);
            //---------------Test Result -----------------------
            Assert.AreEqual(cp.ContactPersonID, myBO.GetPropertyValue("TestProp2"), "This is the ID of the related object");
            Assert.AreEqual(expectedSurname, myBO.GetPropertyValueToDisplay("TestProp2"), "This is the ToString of the related object");
        }