Example #1
0
        public void RollerShutter_Reset()
        {
            var testController = new TestController();
            var adapter        = new TestRollerShutterAdapter();
            var rollerShutter  = new RollerShutter("Test", adapter, testController.GetInstance <ITimerService>(), testController.GetInstance <ISettingsService>());

            rollerShutter.TryReset();
            Assert.AreEqual(1, adapter.StartMoveUpCalledCount);
            Assert.IsTrue(rollerShutter.GetState().Has(PowerState.On));
            Assert.IsTrue(rollerShutter.GetState().Has(VerticalMovingState.MovingUp));
        }
Example #2
0
        public void RollerShutter_AutoOff()
        {
            var testController = new TestController();
            var adapter        = new TestRollerShutterAdapter();
            var rollerShutter  = new RollerShutter("Test", adapter, testController.GetInstance <ITimerService>(), testController.GetInstance <ISettingsService>());

            rollerShutter.TryReset();
            rollerShutter.TryMoveDown();

            Assert.AreEqual(1, adapter.StartMoveUpCalledCount);
            Assert.AreEqual(1, adapter.StartMoveDownCalledCount);

            testController.Tick(TimeSpan.FromHours(1));

            Assert.AreEqual(1, adapter.StopCalledCount);
        }