This is a mapper class that handles the mapping of a property name to a specific property for a specified IBusinessObject. The property name can be specified as a path through single relationships on the IBusinessObject and its' relationship tree. For Example:
For the ContactPerson BusinessObject when the propertyName is "FirstName", the returned IBOProp will be the "FirstName" property on ContactPerson.
If the propertyName was "Organisation.Name" then the Organisation relationship on the contact person will be traversed and monitored and return the corresponding "Name" IBOProp for the ContactPerson's current Organisation.
상속: IBOPropertyMapper
 public void Test_Construct()
 {
     //---------------Set up test pack-------------------
     string propertyName = TestUtil.GetRandomString();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     ReflectionPropertyMapper boPropertyMapper = new ReflectionPropertyMapper(propertyName);
     //---------------Test Result -----------------------
     Assert.AreEqual(propertyName, boPropertyMapper.PropertyName);
     Assert.IsNull(boPropertyMapper.BusinessObject);;
 }
 public void Test_GetPropertyValue_WhenBONull_ShouldRaiseError()
 {
     //---------------Set up test pack-------------------
     const string propName = "ReflectiveProp";
     ReflectionPropertyMapper boPropertyMapper = new ReflectionPropertyMapper(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 ReflectionPropertyMapper for Property '{0}' when the BusinessObject is not set "
             , propName);
         StringAssert.Contains(expectedErrorMessage, ex.Message);
     }
 }
 public void Test_BusinessObject_WhenSetWithBONotHavingSpecifiedProperty_ShouldThrowError()
 {
     //---------------Set up test pack-------------------
     ContactPersonTestBO contactPersonTestBO = new ContactPersonTestBO();
     const string propertyName = "SomeNonExistentProperty";
     ReflectionPropertyMapper boPropertyMapper = new ReflectionPropertyMapper(propertyName);
     //---------------Assert Precondition----------------
     Assert.IsNull(boPropertyMapper.BusinessObject);
     //---------------Execute Test ----------------------
     try
     {
         boPropertyMapper.BusinessObject = contactPersonTestBO;
         Assert.Fail("Expected to throw a HabaneroDeveloperException");
     }
     //---------------Test Result -----------------------
     catch (InvalidPropertyException ex)
     {
         StringAssert.Contains("The property '" + propertyName + "' on '"
                               + contactPersonTestBO.ClassDef.ClassName + "' cannot be found. Please contact your system administrator.", ex.Message);
         Assert.IsNull(boPropertyMapper.BusinessObject);
     }
 }
        public void Test_GetPropertyValue_ShouldSetBOPropsValue()
        {
            //---------------Set up test pack-------------------
            ContactPersonTestBO contactPersonTestBO = new ContactPersonTestBO();
            const string propName = "ReflectiveProp";
            IBOPropertyMapper boPropertyMapper = new ReflectionPropertyMapper(propName) { BusinessObject = contactPersonTestBO };
            var expectedPropValue = RandomValueGen.GetRandomString();
            contactPersonTestBO.ReflectiveProp = expectedPropValue;
            //---------------Assert Precondition----------------
            Assert.IsNotNull(contactPersonTestBO.ReflectiveProp);
            Assert.AreEqual(expectedPropValue, contactPersonTestBO.ReflectiveProp);
            //---------------Execute Test ----------------------

            object actualValue = boPropertyMapper.GetPropertyValue();
            //---------------Test Result -----------------------
            Assert.AreEqual(expectedPropValue, actualValue);
            Assert.AreEqual(expectedPropValue, contactPersonTestBO.ReflectiveProp);
        }
 public void Test_BusinessObject_GetAndSet()
 {
     //---------------Set up test pack-------------------
     ContactPersonTestBO contactPersonTestBO = new ContactPersonTestBO();
     const string propertyName = "FirstName";
     ReflectionPropertyMapper boPropertyMapper = new ReflectionPropertyMapper(propertyName);
     //---------------Assert Precondition----------------
     Assert.IsNull(boPropertyMapper.BusinessObject);
     //---------------Execute Test ----------------------
     boPropertyMapper.BusinessObject = contactPersonTestBO;
     //---------------Test Result -----------------------
     Assert.AreSame(contactPersonTestBO, boPropertyMapper.BusinessObject);
 }