Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void offsetShouldTravelInTime() throws InterruptedException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void offsetShouldTravelInTime()
        {
            long     duration = TWO_DAYS;
            DateTime target   = new DateTime((DateTime.Now).Ticks + duration);

            ClockUtil.offset(duration);

            Thread.Sleep(1100L);

            assertThat(ClockUtil.now()).isCloseTo(target, TWO_SECONDS);
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void resetClockShouldResetToCurrentTime()
        public virtual void resetClockShouldResetToCurrentTime()
        {
            long     duration = TWO_DAYS;
            DateTime target   = new DateTime((DateTime.Now).Ticks + duration);

            ClockUtil.offset(duration);

            assertThat(ClockUtil.now()).isCloseTo(target, ONE_SECOND);

            assertThat(ClockUtil.resetClock()).isCloseTo(DateTime.Now, ONE_SECOND);
            assertThat(ClockUtil.CurrentTime).isCloseTo(DateTime.Now, ONE_SECOND);
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void timeShouldMoveOnAfterTravel() throws InterruptedException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void timeShouldMoveOnAfterTravel()
        {
            DateTime now      = DateTime.Now;
            long     duration = TWO_DAYS;
            DateTime target   = new DateTime(now.Ticks + duration);

            ClockUtil.offset(duration);

            assertThat(ClockUtil.now()).isCloseTo(target, ONE_SECOND);

            Thread.Sleep(FIVE_SECONDS);

            assertThat(ClockUtil.now()).isCloseTo(new DateTime(target.Ticks + FIVE_SECONDS), ONE_SECOND);
        }