Esempio n. 1
0
        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>());
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }