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()); }
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()); }