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); }
private void Setup() { _controller = new TestController(); _controller.SetTime(TimeSpan.Parse("12:00")); var testRollerShutterFactory = new TestRollerShutterFactory(_controller.TimerService, _controller.SchedulerService, new SettingsService(new BackupService(), new StorageService())); _weatherStation = new TestWeatherStation(); _weatherStation.OutdoorTemperature = 20; _rollerShutter = testRollerShutterFactory.CreateTestRollerShutter(); _controller.ComponentService.AddComponent(_rollerShutter); _automation = new RollerShutterAutomation( AutomationIdGenerator.EmptyId, _controller.NotificationService, _controller.SchedulerService, _controller.DateTimeService, _controller.DaylightService, _weatherStation, _controller.ComponentService, new SettingsService(new BackupService(), new StorageService()), new ResourceService(new BackupService(), new StorageService(), new SettingsService(new BackupService(), new StorageService()))); _automation.WithRollerShutters(_rollerShutter); }