GetPropertyValue() 공개 메소드

Return the Property Value for the Property being mapped.
public GetPropertyValue ( ) : object
리턴 object
예제 #1
0
 public void Test_GetPropertyValue_WhenBONull_ShouldRaiseError()
 {
     //---------------Set up test pack-------------------
     const string propName = "Surname";
     BOPropertyMapper boPropertyMapper = new BOPropertyMapper(propName);
     //---------------Assert Precondition----------------
     Assert.IsNull(boPropertyMapper.BusinessObject);
     //---------------Execute Test ----------------------
     try
     {
         boPropertyMapper.GetPropertyValue();
         Assert.Fail("Expected to throw an HabaneroApplicationException");
     }
     //---------------Test Result -----------------------
     catch (HabaneroApplicationException ex)
     {
         string expectedErrorMessage = string.Format(
                 "Tried to GetPropertyValue the BOPropertyMapper for Property '{0}' when the BusinessObject is not set "
                 , propName);
         StringAssert.Contains(expectedErrorMessage, ex.Message);
     }
 }
예제 #2
0
        public void Test_SetPropertyDisplayValue_WithIntString_ShouldBeAbleGetString()
        {
            //---------------Set up test pack-------------------

            ClassDef.ClassDefs.Clear();
            MyBO.LoadDefaultClassDef();
            const string propName = "TestProp";
            var testBo = new MyBO();
            var boMapper = new BOPropertyMapper(propName) { BusinessObject = testBo };
            boMapper.SetPropertyValue("7");
            //---------------Assert Precondition----------------
            Assert.AreEqual("7", boMapper.GetPropertyValue().ToString());
            //---------------Execute Test ----------------------
            boMapper.SetPropertyValue("3");
            //---------------Test Result -----------------------
            Assert.AreEqual("3", boMapper.GetPropertyValue().ToString());
            Assert.AreEqual("3", testBo.TestProp);
        }
예제 #3
0
        public void Test_GetPropertyValue_ShouldSetBOPropsValue()
        {
            //---------------Set up test pack-------------------
            ContactPersonTestBO contactPersonTestBO = new ContactPersonTestBO();
            const string propName = "Surname";
            BOPropertyMapper boPropertyMapper = new BOPropertyMapper(propName) { BusinessObject = contactPersonTestBO };
            var expectedPropValue = RandomValueGen.GetRandomString();
            boPropertyMapper.Property.Value = expectedPropValue;
            //---------------Assert Precondition----------------
            Assert.IsNotNull(boPropertyMapper.Property);
            Assert.AreEqual(expectedPropValue, boPropertyMapper.Property.Value);
            //---------------Execute Test ----------------------

            object actualValue = boPropertyMapper.GetPropertyValue();
            //---------------Test Result -----------------------
            Assert.AreEqual(expectedPropValue, actualValue);
            Assert.AreEqual(expectedPropValue, contactPersonTestBO.Surname);
        }