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.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 Months30 <T>(this T value) => Duration.FromMonths30(Convert.ToDouble(value));
public void NumberToMonths30Test() => Assert.Equal(Duration.FromMonths30(2), 2.Months30());
/// <inheritdoc cref="Duration.FromMonths30(double?)"/> public static Duration?Months30(this decimal?value) => Duration.FromMonths30(value == null ? (double?)null : Convert.ToDouble(value.Value));
public static Duration?Months30 <T>(this T?value) where T : struct => Duration.FromMonths30(value == null ? (double?)null : Convert.ToDouble(value.Value));
/// <inheritdoc cref="Duration.FromMonths30(double)"/> public static Duration Months30(this decimal value) => Duration.FromMonths30(Convert.ToDouble(value));
/// <inheritdoc cref="Duration.FromMonths30(double?)"/> public static Duration?Months30(this float?value) => Duration.FromMonths30(value);
/// <inheritdoc cref="Duration.FromMonths30(double?)"/> public static Duration?Months30(this double?value) => Duration.FromMonths30(value);
/// <inheritdoc cref="Duration.FromMonths30(double?)"/> public static Duration?Months30(this long?value) => Duration.FromMonths30(value);
/// <inheritdoc cref="Duration.FromMonths30(double)"/> public static Duration Months30(this int value) => Duration.FromMonths30(value);