public async Task Set_LightOn_When_Toggled_AndIsOff() { // arrange LightBulbControllerMemory bulb1 = new LightBulbControllerMemory(LightState.Off); LightCoordinator coordinator = new LightCoordinator(); coordinator.AddLightBulb(bulb1); // act await coordinator.ToggleLightState(); var newState = await bulb1.GetLightState(); // assert Assert.AreEqual(LightState.On, newState); }
public async Task Set_AllLightsOff_When_Toggled_AndAllAreOn() { // arrange LightBulbControllerMemory bulb1 = new LightBulbControllerMemory(LightState.On); LightBulbControllerMemory bulb2 = new LightBulbControllerMemory(LightState.On); LightCoordinator coordinator = new LightCoordinator(); coordinator.AddLightBulb(bulb1); coordinator.AddLightBulb(bulb2); // act await coordinator.ToggleLightState(); var newState1 = await bulb1.GetLightState(); var newState2 = await bulb2.GetLightState(); // assert Assert.AreEqual(LightState.Off, newState1); Assert.AreEqual(LightState.Off, newState2); }