コード例 #1
0
 [TestCase(-2147483648)] // Int32.MinValue
 public void TestTicks(int ticks)
 {
     TimeSpanSerializerTestsHelper <C> .TestValue(ticks, ticks.ToString());
 }
コード例 #2
0
        [TestCase(-10675199)] // largest number of Days that can be represented by a TimeSpan
        public void TestDays(long days)
        {
            var ticks = days * TimeSpan.TicksPerDay;

            TimeSpanSerializerTestsHelper <C> .TestValue(ticks, string.Format("NumberLong({0})", days));
        }
コード例 #3
0
        [TestCase(-256204778.80152154)] // largest number of hours that can be represented in a TimeSpan
        public void TestHours(double hours)
        {
            var ticks = (long)(hours * TimeSpan.TicksPerHour);

            TimeSpanSerializerTestsHelper <C> .TestValue(ticks, hours);
        }
コード例 #4
0
        [TestCase(-2147483648)] // Int32.MinValue
        public void TestSeconds(int seconds)
        {
            var ticks = seconds * TimeSpan.TicksPerSecond;

            TimeSpanSerializerTestsHelper <C> .TestValue(ticks, seconds.ToString());
        }
コード例 #5
0
        [TestCase(-9223372036854775800, "NumberLong(\"-9223372036854775800\")")] // almost Int64.MinValue
        public void TestNanoseconds(long nanoseconds, string jsonValue)
        {
            var ticks = nanoseconds / __nanosecondsPerTick;

            TimeSpanSerializerTestsHelper <C> .TestValue(ticks, jsonValue);
        }
コード例 #6
0
        public void TestSecondsUnderflow()
        {
            var ticks = TimeSpan.TicksPerSecond - 1;

            TimeSpanSerializerTestsHelper <C> .TestUnderflow(ticks, "NumberLong(0)");
        }
コード例 #7
0
        public void TestHoursUnderflow()
        {
            var ticks = TimeSpan.TicksPerHour - 1;

            TimeSpanSerializerTestsHelper <C> .TestUnderflow(ticks, "0");
        }
コード例 #8
0
        public void TestMicrosecondsUnderflow()
        {
            var ticks = __ticksPerMicrosecond - 1;

            TimeSpanSerializerTestsHelper <C> .TestUnderflow(ticks, "NumberLong(0)");
        }
コード例 #9
0
        [TestCase(-10675199)] // largest number of Days that can be represented by a TimeSpan
        public void TestDays(int days)
        {
            var ticks = days * TimeSpan.TicksPerDay;

            TimeSpanSerializerTestsHelper <C> .TestValue(ticks, days.ToString());
        }
コード例 #10
0
        [TestCase(-256204778)] // largest number of hours that can be represented in a TimeSpan
        public void TestHours(int hours)
        {
            var ticks = hours * TimeSpan.TicksPerHour;

            TimeSpanSerializerTestsHelper <C> .TestValue(ticks, hours.ToString());
        }
コード例 #11
0
        [TestCase(-922337203685.0)] // largest number of seconds that can be represented in a TimeSpan
        public void TestSeconds(double seconds)
        {
            var ticks = (long)(seconds * TimeSpan.TicksPerSecond);

            TimeSpanSerializerTestsHelper <C> .TestValue(ticks, seconds);
        }
コード例 #12
0
        [TestCase(-15372286728.0)] // largest number of minutes that can be represented in a TimeSpan
        public void TestMinutes(double minutes)
        {
            var ticks = (long)(minutes * TimeSpan.TicksPerMinute);

            TimeSpanSerializerTestsHelper <C> .TestValue(ticks, minutes);
        }
コード例 #13
0
        [TestCase(-922337203685477.0)] // largest number of milliseconds that can be represented in a TimeSpan
        public void TestMilliseconds(double milliseconds)
        {
            var ticks = (long)(milliseconds * TimeSpan.TicksPerMillisecond);

            TimeSpanSerializerTestsHelper <C> .TestValue(ticks, milliseconds);
        }
コード例 #14
0
        [TestCase(-256204778)] // largest number of hours that can be represented in a TimeSpan
        public void TestHours(long hours)
        {
            var ticks = hours * TimeSpan.TicksPerHour;

            TimeSpanSerializerTestsHelper <C> .TestValue(ticks, string.Format("NumberLong({0})", hours));
        }
コード例 #15
0
        [TestCase(-2147483648)] // Int32.MinValue
        public void TestMilliseconds(int milliseconds)
        {
            var ticks = milliseconds * TimeSpan.TicksPerMillisecond;

            TimeSpanSerializerTestsHelper <C> .TestValue(ticks, milliseconds.ToString());
        }
コード例 #16
0
        [TestCase(-922337203685477580, "NumberLong(\"-922337203685477580\")")] // largest number of microseconds that can be represented in a TimeSpan
        public void TestMicroseconds(long microseconds, string jsonValue)
        {
            var ticks = microseconds * __ticksPerMicrosecond;

            TimeSpanSerializerTestsHelper <C> .TestValue(ticks, jsonValue);
        }
コード例 #17
0
        [TestCase(-2147483648)] // Int32.MinValue
        public void TestMinutes(int minutes)
        {
            var ticks = minutes * TimeSpan.TicksPerMinute;

            TimeSpanSerializerTestsHelper <C> .TestValue(ticks, minutes.ToString());
        }
コード例 #18
0
        [TestCase(-15372286728, "NumberLong(\"-15372286728\")")] // largest number of minutes that can be represented in a TimeSpan
        public void TestMinutes(long minutes, string jsonValue)
        {
            var ticks = minutes * TimeSpan.TicksPerMinute;

            TimeSpanSerializerTestsHelper <C> .TestValue(ticks, jsonValue);
        }
コード例 #19
0
        public void TestMinutesUnderflow()
        {
            var ticks = TimeSpan.TicksPerMinute - 1;

            TimeSpanSerializerTestsHelper <C> .TestUnderflow(ticks, "0");
        }
コード例 #20
0
        [TestCase(-922337203685, "NumberLong(\"-922337203685\")")] // largest number of seconds that can be represented in a TimeSpan
        public void TestSeconds(long seconds, string jsonValue)
        {
            var ticks = seconds * TimeSpan.TicksPerSecond;

            TimeSpanSerializerTestsHelper <C> .TestValue(ticks, jsonValue);
        }
コード例 #21
0
        [TestCase(-2147483600)] // almost Int32.MinValue
        public void TestNanoseconds(int nanoseconds)
        {
            var ticks = nanoseconds / __nanosecondsPerTick;

            TimeSpanSerializerTestsHelper <C> .TestValue(ticks, nanoseconds.ToString());
        }
コード例 #22
0
 [TestCase(-9223372036854775808, "\"-10675199.02:48:05.4775808\"")] // long.MinValue
 public void TestTicks(long ticks, string jsonValue)
 {
     TimeSpanSerializerTestsHelper <C> .TestValue(ticks, jsonValue);
 }
コード例 #23
0
        [TestCase(-10675199.116730064)] // largest number of Days that can be represented by a TimeSpan
        public void TestDays(double days)
        {
            var ticks = (long)(days * TimeSpan.TicksPerDay);

            TimeSpanSerializerTestsHelper <C> .TestValue(ticks, days);
        }