Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogMultipleTimes()
        public virtual void ShouldLogMultipleTimes()
        {
            LoggingPhaseTracker phaseTracker = PhaseTracker;

            phaseTracker.EnterPhase(PhaseTracker_Phase.Scan);
            Sleep(100);
            phaseTracker.EnterPhase(PhaseTracker_Phase.Write);
            Sleep(100);
            phaseTracker.Stop();

            Dictionary <PhaseTracker_Phase, LoggingPhaseTracker.Logger> times = phaseTracker.Times();

            foreach (PhaseTracker_Phase phase in times.Keys)
            {
                LoggingPhaseTracker.Logger logger = times[phase];
                if (phase == PhaseTracker_Phase.Scan || phase == PhaseTracker_Phase.Write)
                {
                    assertTrue(logger.TotalTime >= 100);
                    assertTrue(logger.TotalTime < 500);
                }
                else
                {
                    assertEquals(0, logger.TotalTime);
                }
            }
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAccumulateTimes()
        public virtual void ShouldAccumulateTimes()
        {
            LoggingPhaseTracker phaseTracker = PhaseTracker;

            phaseTracker.EnterPhase(PhaseTracker_Phase.Scan);
            Sleep(100);
            phaseTracker.EnterPhase(PhaseTracker_Phase.Write);
            LoggingPhaseTracker.Logger scanLogger = phaseTracker.Times()[PhaseTracker_Phase.Scan];
            long firstCount = scanLogger.TotalTime;

            phaseTracker.EnterPhase(PhaseTracker_Phase.Scan);
            Sleep(100);
            phaseTracker.Stop();

            assertTrue(scanLogger.TotalTime > firstCount);
        }