示例#1
0
        public void TestRollerShutter()
        {
            var timerService         = new TestTimerService();
            var rollerShutterFactory = new TestRollerShutterFactory(timerService, new SchedulerService(timerService, new DateTimeService()), new SettingsService(new BackupService(), new StorageService()));

            TestRollerShutter rollerShutter = rollerShutterFactory.CreateTestRollerShutter();

            rollerShutter.GetState().Equals(RollerShutterStateId.Off).ShouldBeEquivalentTo(true);
            rollerShutter.Endpoint.StopCalledCount.ShouldBeEquivalentTo(1);

            rollerShutter.SetState(RollerShutterStateId.MovingUp);
            rollerShutter.GetState().Equals(RollerShutterStateId.MovingUp).ShouldBeEquivalentTo(true);
            rollerShutter.Endpoint.StartMoveUpCalledCount.ShouldBeEquivalentTo(1);

            rollerShutter.SetState(RollerShutterStateId.MovingDown);
            rollerShutter.GetState().Equals(RollerShutterStateId.MovingDown).ShouldBeEquivalentTo(true);
            rollerShutter.Endpoint.StartMoveDownCalledCount.ShouldBeEquivalentTo(1);

            rollerShutter.SetState(RollerShutterStateId.Off);
            rollerShutter.GetState().Equals(RollerShutterStateId.Off).ShouldBeEquivalentTo(true);
            rollerShutter.Endpoint.StopCalledCount.ShouldBeEquivalentTo(2);

            rollerShutter.Endpoint.StartMoveUpCalledCount.ShouldBeEquivalentTo(1);
            rollerShutter.Endpoint.StartMoveDownCalledCount.ShouldBeEquivalentTo(1);
        }
示例#2
0
        public void SkipOpen_BecauseTooCold()
        {
            Setup();

            _weatherStation.OutdoorTemperature = 1.5F;
            _automation.WithDoNotOpenIfOutsideTemperatureIsBelowThan(2);
            _automation.PerformPendingActions();
            _rollerShutter.GetState().ShouldBeEquivalentTo(RollerShutterStateId.Off);

            Setup();

            _weatherStation.OutdoorTemperature = 2.5F;
            _automation.WithDoNotOpenIfOutsideTemperatureIsBelowThan(2);
            _automation.PerformPendingActions();
            _rollerShutter.GetState().ShouldBeEquivalentTo(RollerShutterStateId.MovingUp);
        }
        public void TestRollerShutter()
        {
            var rollerShutterFactory        = new TestRollerShutterFactory(new TestHomeAutomationTimer());
            TestRollerShutter rollerShutter = rollerShutterFactory.CreateTestRollerShutter();

            rollerShutter.GetState().Equals(RollerShutterStateId.Off).ShouldBeEquivalentTo(true);
            rollerShutter.Endpoint.StopCalledCount.ShouldBeEquivalentTo(1);

            rollerShutter.SetState(RollerShutterStateId.MovingUp);
            rollerShutter.GetState().Equals(RollerShutterStateId.MovingUp).ShouldBeEquivalentTo(true);
            rollerShutter.Endpoint.StartMoveUpCalledCount.ShouldBeEquivalentTo(1);

            rollerShutter.SetState(RollerShutterStateId.MovingDown);
            rollerShutter.GetState().Equals(RollerShutterStateId.MovingDown).ShouldBeEquivalentTo(true);
            rollerShutter.Endpoint.StartMoveDownCalledCount.ShouldBeEquivalentTo(1);

            rollerShutter.SetState(RollerShutterStateId.Off);
            rollerShutter.GetState().Equals(RollerShutterStateId.Off).ShouldBeEquivalentTo(true);
            rollerShutter.Endpoint.StopCalledCount.ShouldBeEquivalentTo(2);

            rollerShutter.Endpoint.StartMoveUpCalledCount.ShouldBeEquivalentTo(1);
            rollerShutter.Endpoint.StartMoveDownCalledCount.ShouldBeEquivalentTo(1);
        }