示例#1
0
        [Ignore("This is ideally how it should work but Current this is not the case so will need to reevaluate as I refactor: Brett")] //TODO Brett 29 Jun 2010: Ignored Test - This is ideally how it should work but Current this is not the case so will need to reevaluate as I refactor: Brett
        public void Test_GetPropertyValue_WhenPropertyNull_ShouldRaiseError()
        {
            //---------------Set up test pack-------------------
            const string        propName         = "Surname";
            BOPropertyMapperSpy boPropertyMapper = new BOPropertyMapperSpy(propName);
            var contactPersonTestBO = new ContactPersonTestBO();

            boPropertyMapper.BusinessObject = contactPersonTestBO;
            boPropertyMapper.SetBOProp(null);
            //---------------Assert Precondition----------------
            Assert.IsNull(boPropertyMapper.Property);
            Assert.AreEqual(propName, boPropertyMapper.PropertyName);
            Assert.IsNull(contactPersonTestBO.Surname);
            //---------------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}' but there is no BOProp for this prop"
                    , propName);
                StringAssert.Contains(expectedErrorMessage, ex.Message);
            }
        }
 [Ignore("This is ideally how it should work but Current this is not the case so will need to reevaluate as I refactor: Brett")] //TODO Brett 29 Jun 2010: Ignored Test - This is ideally how it should work but Current this is not the case so will need to reevaluate as I refactor: Brett
 public void Test_GetPropertyValue_WhenPropertyNull_ShouldRaiseError()
 {
     //---------------Set up test pack-------------------
     const string propName = "Surname";
     BOPropertyMapperSpy boPropertyMapper = new BOPropertyMapperSpy(propName);
     var contactPersonTestBO = new ContactPersonTestBO();
     boPropertyMapper.BusinessObject = contactPersonTestBO;
     boPropertyMapper.SetBOProp(null);
     //---------------Assert Precondition----------------
     Assert.IsNull(boPropertyMapper.Property);
     Assert.AreEqual(propName, boPropertyMapper.PropertyName);
     Assert.IsNull(contactPersonTestBO.Surname);
     //---------------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}' but there is no BOProp for this prop"
                 , propName);
         StringAssert.Contains(expectedErrorMessage, ex.Message);
     }
 }