public void Test_InvalidMessage_WhenMessageSet_ShouldReturnMessage()
        {
            //---------------Set up test pack-------------------
            ReflectionPropertyMapperStub propMapper = new ReflectionPropertyMapperStub();

            propMapper.SetPropInfo(new FakePropertyInfo());
            var expectedMessage = RandomValueGen.GetRandomString();

            propMapper.SetIvalidMessage(expectedMessage);
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            var invalidMessage = propMapper.InvalidReason;

            //---------------Test Result -----------------------
            Assert.AreEqual(expectedMessage, invalidMessage);
        }
        public void Test_InvalidMessage_WhenPropNull_ShouldReturnStdMessage()
        {
            //---------------Set up test pack-------------------
            ReflectionPropertyMapperStub propMapper = new ReflectionPropertyMapperStub();
            PropertyInfo boPropStub = null;

            propMapper.SetPropInfo(boPropStub);
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            var invalidMessage = propMapper.InvalidReason;
            //---------------Test Result -----------------------
            var expectedMessage = string.Format("The Property '{0}' is not available"
                                                , propMapper.PropertyName);

            Assert.AreEqual(expectedMessage, invalidMessage);
        }
        public void Test_InvalidMessage_WhenMessageSet_ThenSetBO_ShouldReturnEmptyMessage()
        {
            //---------------Set up test pack-------------------
            ContactPersonTestBO          contactPersonTestBO = new ContactPersonTestBO();
            const string                 propName            = "ReflectiveProp";
            ReflectionPropertyMapperStub propMapper          = new ReflectionPropertyMapperStub(propName)
            {
                BusinessObject = contactPersonTestBO
            };
            var initialMessage = RandomValueGen.GetRandomString();

            propMapper.SetIvalidMessage(initialMessage);
            //---------------Assert Precondition----------------
            Assert.AreEqual(initialMessage, propMapper.InvalidReason);
            //---------------Execute Test ----------------------
            propMapper.BusinessObject = new ContactPersonTestBO();
            var invalidMessage = ((IBOPropertyMapper)propMapper).InvalidReason;

            //---------------Test Result -----------------------
            Assert.AreEqual("", invalidMessage);
        }
 public void Test_InvalidMessage_WhenMessageSet_ThenSetBO_ShouldReturnEmptyMessage()
 {
     //---------------Set up test pack-------------------
     ContactPersonTestBO contactPersonTestBO = new ContactPersonTestBO();
     const string propName = "ReflectiveProp";
     ReflectionPropertyMapperStub propMapper = new ReflectionPropertyMapperStub(propName) { BusinessObject = contactPersonTestBO };
     var initialMessage = RandomValueGen.GetRandomString();
     propMapper.SetIvalidMessage(initialMessage);
     //---------------Assert Precondition----------------
     Assert.AreEqual(initialMessage, propMapper.InvalidReason);
     //---------------Execute Test ----------------------
     propMapper.BusinessObject = new ContactPersonTestBO();
     var invalidMessage = ((IBOPropertyMapper)propMapper).InvalidReason;
     //---------------Test Result -----------------------
     Assert.AreEqual("", invalidMessage);
 }
 public void Test_InvalidMessage_WhenMessageSet_ShouldReturnMessage()
 {
     //---------------Set up test pack-------------------
     ReflectionPropertyMapperStub propMapper = new ReflectionPropertyMapperStub();
     propMapper.SetPropInfo(new FakePropertyInfo());
     var expectedMessage = RandomValueGen.GetRandomString();
     propMapper.SetIvalidMessage(expectedMessage);
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     var invalidMessage = propMapper.InvalidReason;
     //---------------Test Result -----------------------
     Assert.AreEqual(expectedMessage, invalidMessage);
 }
 public void Test_InvalidMessage_WhenPropNull_ShouldReturnStdMessage()
 {
     //---------------Set up test pack-------------------
     ReflectionPropertyMapperStub propMapper = new ReflectionPropertyMapperStub();
     PropertyInfo boPropStub = null;
     propMapper.SetPropInfo(boPropStub);
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     var invalidMessage = propMapper.InvalidReason;
     //---------------Test Result -----------------------
     var expectedMessage = string.Format("The Property '{0}' is not available"
              , propMapper.PropertyName);
     Assert.AreEqual(expectedMessage, invalidMessage);
 }