public StoreroomConfiguration(
            IAreaService areaService,
            SynonymService synonymService,
            IDeviceService deviceService,
            CCToolsBoardService ccToolsBoardService,
            ITimerService timerService,
            ITwitterClientService twitterClientService,
            AutomationFactory automationFactory,
            ActuatorFactory actuatorFactory,
            SensorFactory sensorFactory)
        {
            if (areaService == null) throw new ArgumentNullException(nameof(areaService));
            if (synonymService == null) throw new ArgumentNullException(nameof(synonymService));
            if (deviceService == null) throw new ArgumentNullException(nameof(deviceService));
            if (ccToolsBoardService == null) throw new ArgumentNullException(nameof(ccToolsBoardService));
            if (timerService == null) throw new ArgumentNullException(nameof(timerService));
            if (twitterClientService == null) throw new ArgumentNullException(nameof(twitterClientService));
            if (automationFactory == null) throw new ArgumentNullException(nameof(automationFactory));
            if (actuatorFactory == null) throw new ArgumentNullException(nameof(actuatorFactory));
            if (sensorFactory == null) throw new ArgumentNullException(nameof(sensorFactory));

            _areaService = areaService;
            _synonymService = synonymService;
            _deviceService = deviceService;
            _ccToolsBoardService = ccToolsBoardService;
            _timerService = timerService;
            _twitterClientService = twitterClientService;
            _automationFactory = automationFactory;
            _actuatorFactory = actuatorFactory;
            _sensorFactory = sensorFactory;
        }
示例#2
0
        public CatLitterBoxTwitterSender(ITimerService timerService, ITwitterClientService twitterClientService, ILogService logService)
        {
            if (timerService == null)
            {
                throw new ArgumentNullException(nameof(timerService));
            }
            if (twitterClientService == null)
            {
                throw new ArgumentNullException(nameof(twitterClientService));
            }
            if (logService == null)
            {
                throw new ArgumentNullException(nameof(logService));
            }

            _twitterClientService = twitterClientService;

            _log = logService.CreatePublisher(nameof(logService));

            _timeout          = new Timeout(timerService);
            _timeout.Elapsed += (s, e) =>
            {
                _timeInLitterBox.Stop();
                Task.Run(() => Tweet(_timeInLitterBox.Elapsed));
            };

            _timeout.Start(TimeSpan.FromSeconds(30));
        }
示例#3
0
        public TweetAction(string message, ITwitterClientService twitterService)
        {
            if (message == null) throw new ArgumentNullException(nameof(message));
            if (twitterService == null) throw new ArgumentNullException(nameof(twitterService));

            _messageProvider = () => message;
            _twitterService = twitterService;
        }
示例#4
0
        public TweetAction(Func<string> messageProvider, ITwitterClientService twitterService)
        {
            if (messageProvider == null) throw new ArgumentNullException(nameof(messageProvider));
            if (twitterService == null) throw new ArgumentNullException(nameof(twitterService));

            _messageProvider = messageProvider;
            _twitterService = twitterService;
        }
示例#5
0
        public StoreroomConfiguration(
            IAreaService areaService,
            SynonymService synonymService,
            IDeviceService deviceService,
            CCToolsBoardService ccToolsBoardService,
            ITimerService timerService,
            ITwitterClientService twitterClientService,
            AutomationFactory automationFactory,
            ActuatorFactory actuatorFactory,
            SensorFactory sensorFactory)
        {
            if (areaService == null)
            {
                throw new ArgumentNullException(nameof(areaService));
            }
            if (synonymService == null)
            {
                throw new ArgumentNullException(nameof(synonymService));
            }
            if (deviceService == null)
            {
                throw new ArgumentNullException(nameof(deviceService));
            }
            if (ccToolsBoardService == null)
            {
                throw new ArgumentNullException(nameof(ccToolsBoardService));
            }
            if (timerService == null)
            {
                throw new ArgumentNullException(nameof(timerService));
            }
            if (twitterClientService == null)
            {
                throw new ArgumentNullException(nameof(twitterClientService));
            }
            if (automationFactory == null)
            {
                throw new ArgumentNullException(nameof(automationFactory));
            }
            if (actuatorFactory == null)
            {
                throw new ArgumentNullException(nameof(actuatorFactory));
            }
            if (sensorFactory == null)
            {
                throw new ArgumentNullException(nameof(sensorFactory));
            }

            _areaService          = areaService;
            _synonymService       = synonymService;
            _deviceService        = deviceService;
            _ccToolsBoardService  = ccToolsBoardService;
            _timerService         = timerService;
            _twitterClientService = twitterClientService;
            _automationFactory    = automationFactory;
            _actuatorFactory      = actuatorFactory;
            _sensorFactory        = sensorFactory;
        }
        public CatLitterBoxTwitterSender(ITimerService timerService, ITwitterClientService twitterClientService)
        {
            if (timerService == null) throw new ArgumentNullException(nameof(timerService));
            if (twitterClientService == null) throw new ArgumentNullException(nameof(twitterClientService));

            _twitterClientService = twitterClientService;

            timerService.Tick += Tick;
        }
示例#7
0
        public TweetAction(string message, ITwitterClientService twitterService)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            _messageProvider = () => message;
            _twitterService  = twitterService ?? throw new ArgumentNullException(nameof(twitterService));
        }
        public static IAction GetTweetAction(this ITwitterClientService twitterClientService, string message)
        {
            if (twitterClientService == null)
            {
                throw new ArgumentNullException(nameof(twitterClientService));
            }
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            return(new TweetAction(message, twitterClientService));
        }
        public static IAction GetTweetAction(this ITwitterClientService twitterClientService, Func <string> messageProvider)
        {
            if (twitterClientService == null)
            {
                throw new ArgumentNullException(nameof(twitterClientService));
            }
            if (messageProvider == null)
            {
                throw new ArgumentNullException(nameof(messageProvider));
            }

            return(new TweetAction(messageProvider, twitterClientService));
        }
示例#10
0
        public TweetAction(Func <string> messageProvider, ITwitterClientService twitterService)
        {
            if (messageProvider == null)
            {
                throw new ArgumentNullException(nameof(messageProvider));
            }
            if (twitterService == null)
            {
                throw new ArgumentNullException(nameof(twitterService));
            }

            _messageProvider = messageProvider;
            _twitterService  = twitterService;
        }
示例#11
0
        public CatLitterBoxTwitterSender(ITimerService timerService, ITwitterClientService twitterClientService)
        {
            if (timerService == null)
            {
                throw new ArgumentNullException(nameof(timerService));
            }
            if (twitterClientService == null)
            {
                throw new ArgumentNullException(nameof(twitterClientService));
            }

            _twitterClientService = twitterClientService;

            timerService.Tick += Tick;
        }
示例#12
0
 public StoreroomConfiguration(
     IAreaRegistryService areaService,
     IDeviceRegistryService deviceService,
     CCToolsDeviceService ccToolsBoardService,
     ITimerService timerService,
     ITwitterClientService twitterClientService,
     AutomationFactory automationFactory,
     ActuatorFactory actuatorFactory,
     SensorFactory sensorFactory,
     ILogService logService)
 {
     _areaService          = areaService ?? throw new ArgumentNullException(nameof(areaService));
     _deviceService        = deviceService ?? throw new ArgumentNullException(nameof(deviceService));
     _ccToolsBoardService  = ccToolsBoardService ?? throw new ArgumentNullException(nameof(ccToolsBoardService));
     _timerService         = timerService ?? throw new ArgumentNullException(nameof(timerService));
     _twitterClientService = twitterClientService ?? throw new ArgumentNullException(nameof(twitterClientService));
     _automationFactory    = automationFactory ?? throw new ArgumentNullException(nameof(automationFactory));
     _actuatorFactory      = actuatorFactory ?? throw new ArgumentNullException(nameof(actuatorFactory));
     _sensorFactory        = sensorFactory ?? throw new ArgumentNullException(nameof(sensorFactory));
     _logService           = logService ?? throw new ArgumentNullException(nameof(logService));
 }
 public TaskAppServiceTest()
 {
     _repository           = Substitute.For <ITaskRepository>();
     _twitterClientService = Substitute.For <ITwitterClientService>();
     _appService           = new TaskAppService(_repository, _twitterClientService);
 }
示例#14
0
 public TwitterClientScriptProxy(ITwitterClientService twitterClientService)
 {
     _twitterClientService = twitterClientService ?? throw new ArgumentNullException(nameof(twitterClientService));
 }
示例#15
0
 public TaskAppService(ITaskRepository repository, ITwitterClientService twitterClient)
 {
     _repository    = repository;
     _twitterClient = twitterClient;
 }