public void ConvertValueToString_UsesUniversalFormat() { //---------------Set up test pack------------------- var dataMapper = new TimeSpanDataMapper(); var originalValue = new TimeSpan(TestUtil.GetRandomInt()); //---------------Execute Test ---------------------- string strValue = dataMapper.ConvertValueToString(originalValue); //---------------Test Result ----------------------- Assert.AreEqual(originalValue.ToString(), strValue); }
public void TryParsePropValue_WhenString_ShouldConvertCorrectly() { //---------------Set up test pack------------------- var dataMapper = new TimeSpanDataMapper(); var originalValue = new TimeSpan(TestUtil.GetRandomInt()); var valueToParse = dataMapper.ConvertValueToString(originalValue); object parsedValue; //---------------Execute Test ---------------------- var parseSucceed = dataMapper.TryParsePropValue(valueToParse, out parsedValue); //---------------Test Result ----------------------- Assert.IsTrue(parseSucceed); Assert.IsInstanceOf(typeof(TimeSpan), parsedValue); Assert.AreEqual(originalValue, parsedValue); }