Beispiel #1
0
        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.FromMonths30m(second.Months30m).Seconds, Months30mTolerance);
            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.FromYears365m(second.Years365m).Seconds, Years365mTolerance);
        }
 public void NumberToMonths30mTest() =>
 Assert.Equal(Duration.FromMonths30m(2), 2.Months30m());
Beispiel #3
0
 public static Duration Months30m <T>(this T value) =>
 Duration.FromMonths30m(Convert.ToDecimal(value));