示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldTimeoutGracefully()
        public virtual void ShouldTimeoutGracefully()
        {
            FakeClock clock = FakeClocks;

            ResourcePool.CheckStrategy timeStrategy = new ResourcePool.CheckStrategy_TimeoutCheckStrategy(TIMEOUT_MILLIS, clock);

            while (clock.Millis() <= TIMEOUT_MILLIS)
            {
                assertFalse(timeStrategy.ShouldCheck());
                clock.Forward(10, TimeUnit.MILLISECONDS);
            }

            assertTrue(timeStrategy.ShouldCheck());

            clock.Forward(1, TimeUnit.MILLISECONDS);
            assertFalse(timeStrategy.ShouldCheck());
        }