public void ConversionRoundTrip() { Duration second = Duration.FromSeconds(1); AssertEx.EqualTolerance(1, Duration.FromDays(second.Days).Seconds, DaysTolerance); AssertEx.EqualTolerance(1, Duration.FromHours(second.Hours).Seconds, HoursTolerance); AssertEx.EqualTolerance(1, Duration.FromJulianYears(second.JulianYears).Seconds, JulianYearsTolerance); AssertEx.EqualTolerance(1, Duration.FromMicroseconds(second.Microseconds).Seconds, MicrosecondsTolerance); AssertEx.EqualTolerance(1, Duration.FromMilliseconds(second.Milliseconds).Seconds, MillisecondsTolerance); AssertEx.EqualTolerance(1, Duration.FromMinutes(second.Minutes).Seconds, MinutesTolerance); AssertEx.EqualTolerance(1, Duration.FromMonths30(second.Months30).Seconds, Months30Tolerance); AssertEx.EqualTolerance(1, Duration.FromNanoseconds(second.Nanoseconds).Seconds, NanosecondsTolerance); AssertEx.EqualTolerance(1, Duration.FromSeconds(second.Seconds).Seconds, SecondsTolerance); AssertEx.EqualTolerance(1, Duration.FromWeeks(second.Weeks).Seconds, WeeksTolerance); AssertEx.EqualTolerance(1, Duration.FromYears365(second.Years365).Seconds, Years365Tolerance); }
public static Duration JulianYears <T>(this T value) => Duration.FromJulianYears(Convert.ToDouble(value));
public void NumberToJulianYearsTest() => Assert.Equal(Duration.FromJulianYears(2), 2.JulianYears());