TryParsePropValue() public method

This method provides the functionality to convert any object to the appropriate type for this mapper. The default behaviour only handles null values, empty strings and DBNull.Value and parses all three to null. This method should be overridden in subtypes to parse values to the type you want.
public TryParsePropValue ( object valueToParse, object &returnValue ) : bool
valueToParse object The value to be attempted to parse
returnValue object the parsed value, if parsing was successful
return bool
        public void TryParsePropValue_WorksForNull()
        {
            //---------------Set up test pack-------------------
            var dataMapper = new ByteArrayDataMapper();
            object parsedValue;
            //---------------Execute Test ----------------------
            var parseSucceed = dataMapper.TryParsePropValue(null, out parsedValue);

            //---------------Test Result -----------------------
            Assert.IsTrue(parseSucceed);
            Assert.IsNull(parsedValue);
        }
        public void TryParsePropValue_WorksForByteArray()
        {
            //---------------Set up test pack-------------------
            var dataMapper = new ByteArrayDataMapper();
            var valueToParse = new byte[200];
            object parsedValue;
            //---------------Execute Test ----------------------
            var parseSucceed = dataMapper.TryParsePropValue(valueToParse, out parsedValue);

            //---------------Test Result -----------------------
            Assert.IsTrue(parseSucceed);
            Assert.AreSame(valueToParse, parsedValue);
        }
 public void TryParsePropValue_ConvertsStringToByteArray()
 {
     //---------------Set up test pack-------------------
     var dataMapper = new ByteArrayDataMapper();
     var val = CreateByteArray();
     var valueToParse = dataMapper.ConvertValueToString(val);
     object parsedValue;
     //---------------Execute Test ----------------------
     var parseSucceed = dataMapper.TryParsePropValue(valueToParse, out parsedValue);
     //---------------Test Result -----------------------
     Assert.IsTrue(parseSucceed);
     Assert.IsInstanceOf(typeof(byte[]), parsedValue);
     Assert.AreEqual(val.Length, ((byte[])parsedValue).Length);
     CollectionAssert.AreEqual(val, (byte[])parsedValue);
 }
 public void TryParsePropValue_FailsForOtherTypes()
 {
     //---------------Set up test pack-------------------
     var dataMapper = new ByteArrayDataMapper();
     object parsedValue;
     //---------------Execute Test ----------------------
     var parsedSucceed = dataMapper.TryParsePropValue(3, out parsedValue);
     //---------------Test Result -----------------------
     Assert.IsFalse(parsedSucceed);
 }