Exemplo n.º 1
0
        public async void HastenHasNoEffectOnRed()
        {
            TrafficLight.Domain.TrafficLight tl = new Domain.TrafficLight(this.dictionary);
            var CurrentStateDuration            = await tl.GetCurrentStateDurationAsync();

            var CurrentState = tl.CurrentState;
            await tl.HastenAsync();

            Assert.Equal(CurrentState, tl.CurrentState);
            Assert.Equal(CurrentStateDuration, await tl.GetCurrentStateDurationAsync());
        }
Exemplo n.º 2
0
        public async void HastenHasEffectOnGreen()
        {
            this.dictionary[enmLightState.Green] = new StateDuration(10, 60);
            TrafficLight.Domain.TrafficLight tl = new Domain.TrafficLight(this.dictionary);
            await tl.ChangeStateAsync(enmLightState.Green);

            var CurrentState         = tl.CurrentState;
            var CurrentStateDuration = await tl.GetCurrentStateDurationAsync();

            Assert.Equal(enmLightState.Green, CurrentState);
            Assert.True(await tl.GetCurrentStateDurationAsync() + 30 <= this.dictionary[enmLightState.Green].MaxDuration);
            await tl.HastenAsync();

            Assert.Equal(enmLightState.Green, tl.CurrentState);
            Assert.Equal(CurrentStateDuration += 30, await tl.GetCurrentStateDurationAsync());
        }