コード例 #1
0
        public void ConvertingFromFormattedTimeSpanSucceeds()
        {
            var converter = new TimeSpanOrInfiniteConverter();

            var result = converter.ConvertFrom(null, CultureInfo.InvariantCulture, "1.23:45:56.789");

            Assert.AreEqual(new TimeSpan(1, 23, 45, 56, 789), result);
        }
コード例 #2
0
        public void ConvertingFromInfiniteTimeSpanSucceeds()
        {
            var converter = new TimeSpanOrInfiniteConverter();

            var result = converter.ConvertFrom(null, CultureInfo.InvariantCulture, "infinite");

            Assert.AreEqual(Timeout.InfiniteTimeSpan, result);
        }
コード例 #3
0
        public void ConvertingInfiniteTimeoutToStringReturnsCustomString()
        {
            var converter = new TimeSpanOrInfiniteConverter();

            var result = converter.ConvertTo(null, CultureInfo.InvariantCulture, Timeout.InfiniteTimeSpan, typeof(string));

            Assert.AreEqual("infinite", result);
        }
コード例 #4
0
        public void ConvertingFromNullStringFails()
        {
            var converter = new TimeSpanOrInfiniteConverter();

            var result = converter.ConvertFrom(null, CultureInfo.InvariantCulture, 4);
        }
コード例 #5
0
        public void ConvertingNonInfiniteTimeoutToStringReturnsFormattedString()
        {
            var converter = new TimeSpanOrInfiniteConverter();

            var result = converter.ConvertTo(null, CultureInfo.InvariantCulture, new TimeSpan(1, 23, 45, 56, 789), typeof(string));

            Assert.AreEqual("1.23:45:56.7890000", result);
        }