Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldTruncateOffsetSeconds()
        internal virtual void ShouldTruncateOffsetSeconds()
        {
            OffsetTime time = OffsetTime.of(14, 55, 50, 0, ZoneOffset.ofHoursMinutesSeconds(2, 15, 45));

            OffsetTime truncatedTime = TemporalUtil.TruncateOffsetToMinutes(time);

            assertEquals(OffsetTime.of(14, 55, 5, 0, ZoneOffset.ofHoursMinutes(2, 15)), truncatedTime);
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldConvertNanosOfDayToUTCWhenOffsetIsZero()
        internal virtual void ShouldConvertNanosOfDayToUTCWhenOffsetIsZero()
        {
            int nanosOfDayLocal = 42;

            long nanosOfDayUTC = TemporalUtil.NanosOfDayToUTC(nanosOfDayLocal, 0);

            assertEquals(nanosOfDayLocal, nanosOfDayUTC);
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldDoNothingForOffsetWithoutSeconds()
        internal virtual void ShouldDoNothingForOffsetWithoutSeconds()
        {
            OffsetTime time = OffsetTime.of(23, 30, 10, 0, ZoneOffset.ofHoursMinutes(-5, -30));

            OffsetTime truncatedTime = TemporalUtil.TruncateOffsetToMinutes(time);

            assertEquals(time, truncatedTime);
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldConvertNanosOfDayToUTC()
        internal virtual void ShouldConvertNanosOfDayToUTC()
        {
            int      nanosOfDayLocal = 42;
            Duration offsetDuration  = Duration.ofMinutes(35);

            long nanosOfDayUTC = TemporalUtil.NanosOfDayToUTC(nanosOfDayLocal, ( int )offsetDuration.Seconds);

            assertEquals(nanosOfDayLocal - offsetDuration.toNanos(), nanosOfDayUTC);
        }
Exemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldGetNanosOfDayUTC()
        internal virtual void ShouldGetNanosOfDayUTC()
        {
            LocalTime  localTime = LocalTime.of(14, 19, 18, 123999);
            ZoneOffset offset    = ZoneOffset.ofHours(-12);
            OffsetTime time      = OffsetTime.of(localTime, offset);

            long nanosOfDayUTC = TemporalUtil.GetNanosOfDayUTC(time);

            long expectedNanosOfDayUTC = Duration.ofSeconds(localTime.toSecondOfDay()).minus(offset.TotalSeconds, SECONDS).toNanos();

            assertEquals(expectedNanosOfDayUTC + localTime.Nano, nanosOfDayUTC);
        }