예제 #1
0
        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);
        }
예제 #2
0
        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);
        }