[InlineData(-2147483648)] // Int32.MinValue public void TestTicks(int ticks) { TimeSpanSerializerTestsHelper <C> .TestValue(ticks, ticks.ToString()); }
[InlineData(-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)); }
[InlineData(-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); }
[InlineData(-2147483648)] // Int32.MinValue public void TestSeconds(int seconds) { var ticks = seconds * TimeSpan.TicksPerSecond; TimeSpanSerializerTestsHelper <C> .TestValue(ticks, seconds.ToString()); }
[InlineData(-9223372036854775800, "NumberLong(\"-9223372036854775800\")")] // almost Int64.MinValue public void TestNanoseconds(long nanoseconds, string jsonValue) { var ticks = nanoseconds / __nanosecondsPerTick; TimeSpanSerializerTestsHelper <C> .TestValue(ticks, jsonValue); }
public void TestSecondsUnderflow() { var ticks = TimeSpan.TicksPerSecond - 1; TimeSpanSerializerTestsHelper <C> .TestUnderflow(ticks, "NumberLong(0)"); }
public void TestHoursUnderflow() { var ticks = TimeSpan.TicksPerHour - 1; TimeSpanSerializerTestsHelper <C> .TestUnderflow(ticks, "0"); }
public void TestMicrosecondsUnderflow() { var ticks = __ticksPerMicrosecond - 1; TimeSpanSerializerTestsHelper <C> .TestUnderflow(ticks, "NumberLong(0)"); }
[InlineData(-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()); }
[InlineData(-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()); }
[InlineData(-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); }
[InlineData(-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); }
[InlineData(-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); }
[InlineData(-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)); }
[InlineData(-2147483648)] // Int32.MinValue public void TestMilliseconds(int milliseconds) { var ticks = milliseconds * TimeSpan.TicksPerMillisecond; TimeSpanSerializerTestsHelper <C> .TestValue(ticks, milliseconds.ToString()); }
[InlineData(-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); }
[InlineData(-2147483648)] // Int32.MinValue public void TestMinutes(int minutes) { var ticks = minutes * TimeSpan.TicksPerMinute; TimeSpanSerializerTestsHelper <C> .TestValue(ticks, minutes.ToString()); }
[InlineData(-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); }
public void TestMinutesUnderflow() { var ticks = TimeSpan.TicksPerMinute - 1; TimeSpanSerializerTestsHelper <C> .TestUnderflow(ticks, "0"); }
[InlineData(-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); }
[InlineData(-2147483600)] // almost Int32.MinValue public void TestNanoseconds(int nanoseconds) { var ticks = nanoseconds / __nanosecondsPerTick; TimeSpanSerializerTestsHelper <C> .TestValue(ticks, nanoseconds.ToString()); }
[InlineData(-9223372036854775808, "\"-10675199.02:48:05.4775808\"")] // long.MinValue public void TestTicks(long ticks, string jsonValue) { TimeSpanSerializerTestsHelper <C> .TestValue(ticks, jsonValue); }
[InlineData(-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); }