Beispiel #1
0
        private void Setup()
        {
            _controller = new TestController();
            _controller.SetTime(TimeSpan.Parse("12:00"));

            var testRollerShutterFactory = new TestRollerShutterFactory(_controller.Timer);

            _weatherStation = new TestWeatherStation();
            _weatherStation.SetTemperature(20);
            _daylightService = new TestDaylightService();

            _rollerShutter = testRollerShutterFactory.CreateTestRollerShutter();
            _controller.ServiceLocator.RegisterService(typeof(TestWeatherStation), _weatherStation);
            _controller.AddComponent(_rollerShutter);

            _automation = new RollerShutterAutomation(
                AutomationIdFactory.EmptyId,
                _controller.ServiceLocator.GetService <ISchedulerService>(),
                _controller.ServiceLocator.GetService <IDateTimeService>(),
                _daylightService,
                _weatherStation,
                _controller);

            _automation.WithRollerShutters(_rollerShutter);
        }
Beispiel #2
0
        public void SkipOpen_BecauseTooCold()
        {
            Setup();

            _weatherStation.SetTemperature(1.5F);
            _automation.WithDoNotOpenIfOutsideTemperatureIsBelowThan(2);
            _automation.PerformPendingActions();
            _rollerShutter.GetState().ShouldBeEquivalentTo(RollerShutterState.Stopped);

            Setup();

            _weatherStation.SetTemperature(2.5F);
            _automation.WithDoNotOpenIfOutsideTemperatureIsBelowThan(2);
            _automation.PerformPendingActions();
            _rollerShutter.GetState().ShouldBeEquivalentTo(RollerShutterState.MovingUp);
        }
        private void Setup()
        {
            _controller = new TestController();
            _controller.SetTime(TimeSpan.Parse("12:00"));

            var testRollerShutterFactory = new TestRollerShutterFactory(_controller.Timer);

            _weatherStation = new TestWeatherStation(new DeviceId("Test.WeatherStation"), _controller.Timer);
            _weatherStation.SetTemperature(20);
            _daylightService = new TestDaylightService();

            _rollerShutter = testRollerShutterFactory.CreateTestRollerShutter();
            _controller.RegisterService(_weatherStation);
            _controller.AddComponent(_rollerShutter);

            _automation = new RollerShutterAutomation(
                AutomationIdFactory.EmptyId,
                _controller.Timer,
                _daylightService,
                _weatherStation,
                _controller);

            _automation.WithRollerShutters(_rollerShutter);
        }