Ejemplo n.º 1
0
        public void TimerService_ShouldRunNewTimer_OnRunNewTimer()
        {
            var timerService = new TimerService();
            var settingsMock = new Mock <ISimulationSettings>();

            settingsMock.Setup(s => s.IncomingFlights).Returns(new Mock <List <Flight> >().Object);
            settingsMock.Setup(s => s.OutgoingFlights).Returns(new Mock <List <Flight> >().Object);
            settingsMock.Setup(s => s.Multiplier).Returns(1);

            timerService.SetSettings(settingsMock.Object);

            timerService.RunNewTimer();
            Thread.Sleep(2000);
            timerService.Stop();

            timerService.GetTimeSinceSimulationStart().TotalMilliseconds.ShouldBeGreaterThan(2000);

            timerService.RunNewTimer();
            timerService.Stop();
            timerService.GetTimeSinceSimulationStart().TotalMilliseconds.ShouldBeLessThan(2000);
        }