public void Fan_Feature() { var adapter = new TestFanAdapter { MaxLevel = 3, CurrentLevel = -1 }; var fan = CreateFan(adapter); Assert.AreEqual(3, fan.GetFeatures().Extract <LevelFeature>().MaxLevel); Assert.IsTrue(fan.GetFeatures().Supports <PowerStateFeature>()); Assert.IsTrue(fan.GetFeatures().Supports <LevelFeature>()); }
public void Fan_Reset() { var adapter = new TestFanAdapter { MaxLevel = 3, CurrentLevel = -1 }; var fan = CreateFan(adapter); fan.ResetState(); Assert.AreEqual(0, fan.GetState().Extract <LevelState>().Value); Assert.AreEqual(0, adapter.CurrentLevel); }
public void Fan_LevelUnderrun() { var adapter = new TestFanAdapter { MaxLevel = 3, CurrentLevel = -1 }; var fan = CreateFan(adapter); fan.ResetState(); Assert.AreEqual(0, fan.GetState().Extract <LevelState>().Value); Assert.AreEqual(0, adapter.CurrentLevel); fan.ExecuteCommand(new DecreaseLevelCommand()); Assert.AreEqual(3, fan.GetState().Extract <LevelState>().Value); Assert.AreEqual(3, adapter.CurrentLevel); }
public void Fan_SetLevel() { var adapter = new TestFanAdapter { MaxLevel = 3, CurrentLevel = -1 }; var fan = CreateFan(adapter); fan.ResetState(); Assert.AreEqual(0, fan.GetState().Extract <LevelState>().Value); Assert.AreEqual(0, adapter.CurrentLevel); fan.ExecuteCommand(new SetLevelCommand { Level = 2 }); Assert.AreEqual(2, fan.GetState().Extract <LevelState>().Value); Assert.AreEqual(2, adapter.CurrentLevel); }