public LowerBathroomConfiguration(
            IDeviceService deviceService,
            ISchedulerService schedulerService,
            IAreaService areaService,
            SynonymService synonymService,
            AutomationFactory automationFactory,
            ActuatorFactory actuatorFactory,
            SensorFactory sensorFactory)
        {
            if (deviceService == null) throw new ArgumentNullException(nameof(deviceService));
            if (schedulerService == null) throw new ArgumentNullException(nameof(schedulerService));
            if (areaService == null) throw new ArgumentNullException(nameof(areaService));
            if (synonymService == null) throw new ArgumentNullException(nameof(synonymService));
            if (automationFactory == null) throw new ArgumentNullException(nameof(automationFactory));
            if (actuatorFactory == null) throw new ArgumentNullException(nameof(actuatorFactory));
            if (sensorFactory == null) throw new ArgumentNullException(nameof(sensorFactory));

            _deviceService = deviceService;
            _schedulerService = schedulerService;
            _areaService = areaService;
            _synonymService = synonymService;
            _automationFactory = automationFactory;
            _actuatorFactory = actuatorFactory;
            _sensorFactory = sensorFactory;
        }
        public OfficeConfiguration(
            IDeviceService deviceService,
            IAreaService areaService,
            IDaylightService daylightService,
            CCToolsBoardService ccToolsBoardService,
            SynonymService synonymService,
            RemoteSocketService remoteSocketService,
            ActuatorFactory actuatorFactory,
            SensorFactory sensorFactory)
        {
            if (deviceService == null) throw new ArgumentNullException(nameof(deviceService));
            if (areaService == null) throw new ArgumentNullException(nameof(areaService));
            if (daylightService == null) throw new ArgumentNullException(nameof(daylightService));
            if (ccToolsBoardService == null) throw new ArgumentNullException(nameof(ccToolsBoardService));
            if (synonymService == null) throw new ArgumentNullException(nameof(synonymService));
            if (remoteSocketService == null) throw new ArgumentNullException(nameof(remoteSocketService));
            if (actuatorFactory == null) throw new ArgumentNullException(nameof(actuatorFactory));
            if (sensorFactory == null) throw new ArgumentNullException(nameof(sensorFactory));

            _deviceService = deviceService;
            _areaService = areaService;
            _daylightService = daylightService;
            _ccToolsBoardService = ccToolsBoardService;
            _synonymService = synonymService;
            _remoteSocketService = remoteSocketService;
            _actuatorFactory = actuatorFactory;
            _sensorFactory = sensorFactory;
        }
Exemplo n.º 3
0
            public Configuration(
                CCToolsBoardService ccToolsBoardService, 
                IPi2GpioService pi2GpioService, 
                SynonymService synonymService,
                IDeviceService deviceService,
                II2CBusService i2CBusService, 
                ISchedulerService schedulerService, 
                RemoteSocketService remoteSocketService, 
                IApiService apiService,
                IContainer containerService)
            {
                if (ccToolsBoardService == null) throw new ArgumentNullException(nameof(ccToolsBoardService));
                if (pi2GpioService == null) throw new ArgumentNullException(nameof(pi2GpioService));
                if (synonymService == null) throw new ArgumentNullException(nameof(synonymService));
                if (deviceService == null) throw new ArgumentNullException(nameof(deviceService));
                if (i2CBusService == null) throw new ArgumentNullException(nameof(i2CBusService));
                if (schedulerService == null) throw new ArgumentNullException(nameof(schedulerService));
                if (remoteSocketService == null) throw new ArgumentNullException(nameof(remoteSocketService));
                if (apiService == null) throw new ArgumentNullException(nameof(apiService));
                if (containerService == null) throw new ArgumentNullException(nameof(containerService));

                _ccToolsBoardService = ccToolsBoardService;
                _pi2GpioService = pi2GpioService;
                _synonymService = synonymService;
                _deviceService = deviceService;
                _i2CBusService = i2CBusService;
                _schedulerService = schedulerService;
                _remoteSocketService = remoteSocketService;
                _apiService = apiService;
                _containerService = containerService;
            }
        static void Main(string[] args)
        {
            // Get the AppSettings section.
            ApplicationConfig config = new ApplicationConfig();

            // Display synonyms
            Console.WriteLine(config.GetSynNetEndPoint());
            SynonymService ss = new SynonymService(config.GetSynNetEndPoint());
            displaySynonyms(ss, "account");
            displaySynonyms(ss, "abc123");

            // Display word definitions
            Console.WriteLine(config.GetWordDefinitionEndPoint());
            WordDefinitionService wds = new WordDefinitionService(config.GetWordDefinitionEndPoint());
            displayDefinitions(wds, "account");
            displayDefinitions(wds, "abc123");

            // Get TextMiner response
            TextMinerService tms = new TextMinerService(config.GetTextMinerEndPoint());
            string apiKey = "API_KEY";
            displayResults(tms, apiKey, 243);
            displayResults(tms, apiKey, 9876542);

            // Post a new article
            tms = new TextMinerService(config.GetTextMinerEndPoint());
            displaySubmittedarticleResponse(tms);

            // Request for a new client API key
            // or drop us a line at [email protected] or @happystrider
            ClientService cs = new ClientService(config.GetClientServiceEndPoint());
            displayApiKey(cs, "Strider Digital Intelligence", "*****@*****.**", "Strider Digital Intelligence");
        }
        public void Init()
        {
            var memoryCache = new MemoryCache(new MemoryCacheOptions());

            _synonymService = new SynonymService(memoryCache);
            _wordService    = new WordService(memoryCache);
        }
 public MainPageViewModel()
 {
     t_service = new TranslationService();
     l_service = new LanguageListService();
     s_service = new SynonymService();
     InitSynonym();
 }
        public BedroomConfiguration(
            IDeviceService deviceService,
            IAreaService areaService,
            CCToolsBoardService ccToolsBoardService,
            SynonymService synonymService,
            ActuatorFactory actuatorFactory,
            SensorFactory sensorFactory,
            AutomationFactory automationFactory)
        {
            if (deviceService == null) throw new ArgumentNullException(nameof(deviceService));
            if (areaService == null) throw new ArgumentNullException(nameof(areaService));
            if (ccToolsBoardService == null) throw new ArgumentNullException(nameof(ccToolsBoardService));
            if (synonymService == null) throw new ArgumentNullException(nameof(synonymService));
            if (actuatorFactory == null) throw new ArgumentNullException(nameof(actuatorFactory));
            if (sensorFactory == null) throw new ArgumentNullException(nameof(sensorFactory));
            if (automationFactory == null) throw new ArgumentNullException(nameof(automationFactory));

            _deviceService = deviceService;
            _areaService = areaService;
            _ccToolsBoardService = ccToolsBoardService;
            _synonymService = synonymService;
            _actuatorFactory = actuatorFactory;
            _sensorFactory = sensorFactory;
            _automationFactory = automationFactory;
        }
        public MessageContextFactory(SynonymService synonymService, IAreaService areaService)
        {
            if (synonymService == null) throw new ArgumentNullException(nameof(synonymService));
            if (areaService == null) throw new ArgumentNullException(nameof(areaService));

            _synonymService = synonymService;
            _areaService = areaService;
        }
Exemplo n.º 9
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;
        }
Exemplo n.º 10
0
        public UpperBathroomConfiguration(
            CCToolsBoardService ccToolsBoardService,
            IDeviceService deviceService,
            ISchedulerService schedulerService,
            IAreaService areaService,
            ISettingsService settingsService,
            SynonymService synonymService,
            AutomationFactory automationFactory,
            ActuatorFactory actuatorFactory,
            SensorFactory sensorFactory)
        {
            if (ccToolsBoardService == null)
            {
                throw new ArgumentNullException(nameof(ccToolsBoardService));
            }
            if (deviceService == null)
            {
                throw new ArgumentNullException(nameof(deviceService));
            }
            if (schedulerService == null)
            {
                throw new ArgumentNullException(nameof(schedulerService));
            }
            if (areaService == null)
            {
                throw new ArgumentNullException(nameof(areaService));
            }
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }
            if (synonymService == null)
            {
                throw new ArgumentNullException(nameof(synonymService));
            }
            if (automationFactory == null)
            {
                throw new ArgumentNullException(nameof(automationFactory));
            }
            if (actuatorFactory == null)
            {
                throw new ArgumentNullException(nameof(actuatorFactory));
            }
            if (sensorFactory == null)
            {
                throw new ArgumentNullException(nameof(sensorFactory));
            }

            _ccToolsBoardService = ccToolsBoardService;
            _deviceService       = deviceService;
            _schedulerService    = schedulerService;
            _areaService         = areaService;
            _settingsService     = settingsService;
            _synonymService      = synonymService;
            _automationFactory   = automationFactory;
            _actuatorFactory     = actuatorFactory;
            _sensorFactory       = sensorFactory;
        }
Exemplo n.º 11
0
            public Configuration(
                CCToolsBoardService ccToolsBoardService,
                IPi2GpioService pi2GpioService,
                SynonymService synonymService,
                IDeviceService deviceService,
                II2CBusService i2CBusService,
                ISchedulerService schedulerService,
                RemoteSocketService remoteSocketService,
                IApiService apiService,
                IContainer containerService)
            {
                if (ccToolsBoardService == null)
                {
                    throw new ArgumentNullException(nameof(ccToolsBoardService));
                }
                if (pi2GpioService == null)
                {
                    throw new ArgumentNullException(nameof(pi2GpioService));
                }
                if (synonymService == null)
                {
                    throw new ArgumentNullException(nameof(synonymService));
                }
                if (deviceService == null)
                {
                    throw new ArgumentNullException(nameof(deviceService));
                }
                if (i2CBusService == null)
                {
                    throw new ArgumentNullException(nameof(i2CBusService));
                }
                if (schedulerService == null)
                {
                    throw new ArgumentNullException(nameof(schedulerService));
                }
                if (remoteSocketService == null)
                {
                    throw new ArgumentNullException(nameof(remoteSocketService));
                }
                if (apiService == null)
                {
                    throw new ArgumentNullException(nameof(apiService));
                }
                if (containerService == null)
                {
                    throw new ArgumentNullException(nameof(containerService));
                }

                _ccToolsBoardService = ccToolsBoardService;
                _pi2GpioService      = pi2GpioService;
                _synonymService      = synonymService;
                _deviceService       = deviceService;
                _i2CBusService       = i2CBusService;
                _schedulerService    = schedulerService;
                _remoteSocketService = remoteSocketService;
                _apiService          = apiService;
                _containerService    = containerService;
            }
Exemplo n.º 12
0
        public OfficeConfiguration(
            IDeviceService deviceService,
            IAreaService areaService,
            IDaylightService daylightService,
            CCToolsBoardService ccToolsBoardService,
            SynonymService synonymService,
            RemoteSocketService remoteSocketService,
            ActuatorFactory actuatorFactory,
            SensorFactory sensorFactory)
        {
            if (deviceService == null)
            {
                throw new ArgumentNullException(nameof(deviceService));
            }
            if (areaService == null)
            {
                throw new ArgumentNullException(nameof(areaService));
            }
            if (daylightService == null)
            {
                throw new ArgumentNullException(nameof(daylightService));
            }
            if (ccToolsBoardService == null)
            {
                throw new ArgumentNullException(nameof(ccToolsBoardService));
            }
            if (synonymService == null)
            {
                throw new ArgumentNullException(nameof(synonymService));
            }
            if (remoteSocketService == null)
            {
                throw new ArgumentNullException(nameof(remoteSocketService));
            }
            if (actuatorFactory == null)
            {
                throw new ArgumentNullException(nameof(actuatorFactory));
            }
            if (sensorFactory == null)
            {
                throw new ArgumentNullException(nameof(sensorFactory));
            }

            _deviceService       = deviceService;
            _areaService         = areaService;
            _daylightService     = daylightService;
            _ccToolsBoardService = ccToolsBoardService;
            _synonymService      = synonymService;
            _remoteSocketService = remoteSocketService;
            _actuatorFactory     = actuatorFactory;
            _sensorFactory       = sensorFactory;
        }
        public void ParseWords()
        {
            var synonymService        = new SynonymService();
            var messageContextFactory = new MessageContextFactory(synonymService);

            MessageContext messageContext = messageContextFactory.Create(new TestInboundMessage("Hello World. Hello World."));

            messageContext.IdentifiedAreaIds.Count.ShouldBeEquivalentTo(0);
            messageContext.IdentifiedComponentIds.Count.ShouldBeEquivalentTo(0);
            messageContext.IdentifiedComponentStates.Count.ShouldBeEquivalentTo(0);

            messageContext.Words.Count.ShouldBeEquivalentTo(3);
        }
Exemplo n.º 14
0
        public async Task GetSynonyms_ReturnsNull()
        {
            // arrange
            Environment.SetEnvironmentVariable("BigHugeThesaurusApiEndpoint", "https://fake/");
            Environment.SetEnvironmentVariable("BigHugeThesaurusApiKey", "tempkey");
            var service = new SynonymService(new HttpClient(new NotFoundHttpMessageHandler()));

            // act
            var result = await service.GetSynonymsAsync("searchterm");

            // assert
            Assert.Null(result);
        }
Exemplo n.º 15
0
        public async Task GetSynonyms_ReturnsSynonyms()
        {
            // arrange
            Environment.SetEnvironmentVariable("BigHugeThesaurusApiEndpoint", "https://fake/");
            Environment.SetEnvironmentVariable("BigHugeThesaurusApiKey", "tempkey");
            var service = new SynonymService(new HttpClient(new MockHttpMessageHandler(GetFileResourceString("sample.json"))));

            // act
            var result = await service.GetSynonymsAsync("searchterm");

            // assert
            Assert.Equal(67, result.Count);
        }
 static void displaySynonyms(SynonymService ss, string word)
 {
     Console.WriteLine("Display synonyms");
     Synonyms dto = ss.GetSynonyms(word);
     if (dto.synonyms == null)
     {
         Console.WriteLine("No synonym is available");
     }
     else
     {
         Console.WriteLine(dto);
     }
 }
        public void ParseWords()
        {
            var testController = new TestController();

            var synonymService = new SynonymService(testController.ComponentService);
            var messageContextFactory = new MessageContextFactory(synonymService, testController.AreaService);

            MessageContext messageContext = messageContextFactory.Create(new TestInboundMessage("Hello World. Hello World."));
            messageContext.IdentifiedAreaIds.Count.ShouldBeEquivalentTo(0);
            messageContext.IdentifiedComponentIds.Count.ShouldBeEquivalentTo(0);
            messageContext.IdentifiedComponentStates.Count.ShouldBeEquivalentTo(0);

            messageContext.Words.Count.ShouldBeEquivalentTo(2);
        }
Exemplo n.º 18
0
        public async Task TestITISPlantInfoProcessor()
        {
            var transformer = new ITISPlantInfoTransformer();
            var itisData    = ITISPlantInfoData();
            var plantInfos  = new List <PlantInfo>();

            itisData.ForEach(i => plantInfos.AddRange(transformer.Transform(new List <TaxonomicUnit> {
                i
            })));

            var originRepository        = RepositoryMocks.GetStandardMockOriginRepository(new List <Stores.Origin>());
            var locationRepository      = RepositoryMocks.GetStandardMockLocationRepository(new List <Stores.Location>());
            var lifeformRepository      = RepositoryMocks.GetStandardMockLifeformRepository(new List <Stores.Lifeform>());
            var plantInfoRepository     = RepositoryMocks.GetStandardMockPlantInfoRepository(new List <Stores.PlantInfo>());
            var plantLocationRepository = RepositoryMocks.GetStandardMockPlantLocationRepository(new List <Stores.PlantLocation>());
            var synonymRepository       = RepositoryMocks.GetStandardMockSynonymRepository();
            var taxonRepository         = RepositoryMocks.GetStandardMockTaxonRepository(new List <Stores.Taxon>());
            var plantSynonymRepository  = new Mock <IRepository <Stores.PlantSynonym> >();
            var plantInfoIndex          = SearchMocks.GetStandardMockPlantInfoIndex();
            var lifeformIndex           = SearchMocks.GetStandardMockLifeformIndex();

            var locationService  = new LocationService(locationRepository.Object);
            var originService    = new OriginService(originRepository.Object, locationService);
            var lifeformService  = new LifeformService(lifeformRepository.Object, lifeformIndex.Object);
            var plantInfoService = new PlantInfoService(plantInfoRepository.Object, plantLocationRepository.Object, plantInfoIndex.Object);
            var synonymService   = new SynonymService(synonymRepository.Object);
            var taxonService     = new TaxonService(taxonRepository.Object, synonymService);

            var processor = new PlantInfoProcessor(lifeformService, originService, plantInfoService, taxonService, locationService);

            await processor.InitializeOrigin(transformer.Origin);

            await processor.InitializeLifeforms();

            await processor.InitializeTaxons();

            var result = await processor.Process(plantInfos);

            result.Count(p => p.ScientificName == "Glandularia quadrangulata").Should().Be(1);
            result.Count(p => p.Taxon.Subfamily == null).Should().Be(5);
            result.Count(p => p.Taxon.Species == "cremersii").Should().Be(1);
            result.Count(p => p.Taxon.Form == "viridifolia").Should().Be(1);
            result.Count(p => p.Taxon.Subspecies == "purpurea").Should().Be(1);
            result.Count(p => p.Taxon.Variety == "graminea").Should().Be(1);
            result.Where(p => p.Locations != null).SelectMany(p => p.Locations).Count().Should().Be(3);
            result.Where(p => p.Locations != null).SelectMany(p => p.Locations).Count(l => l.Status == LocationStatus.Native).Should().Be(3);
            result.Select(p => p.Origin).DistinctBy(o => o.OriginId).Count().Should().Be(5);
        }
        public void IdentifyAreaIds()
        {
            var testController = new TestController();

            var synonymService = new SynonymService(testController.ComponentService);
            synonymService.AddSynonymsForArea(new AreaId("Office"), "Büro");

            var messageContextFactory = new MessageContextFactory(synonymService, testController.AreaService);

            MessageContext messageContext = messageContextFactory.Create(new TestInboundMessage("Hello World. Büro."));
            messageContext.IdentifiedAreaIds.Count.ShouldBeEquivalentTo(1);
            messageContext.IdentifiedComponentIds.Count.ShouldBeEquivalentTo(0);
            messageContext.IdentifiedComponentStates.Count.ShouldBeEquivalentTo(0);

            messageContext.Words.Count.ShouldBeEquivalentTo(3);
        }
        public void IdentifyAreaIds()
        {
            var synonymService = new SynonymService();

            synonymService.AddSynonymsForArea(new AreaId("Office"), "Büro");

            var messageContextFactory = new MessageContextFactory(synonymService);

            MessageContext messageContext = messageContextFactory.Create(new TestInboundMessage("Hello World. Büro."));

            messageContext.IdentifiedAreaIds.Count.ShouldBeEquivalentTo(1);
            messageContext.IdentifiedComponentIds.Count.ShouldBeEquivalentTo(0);
            messageContext.IdentifiedComponentStates.Count.ShouldBeEquivalentTo(0);

            messageContext.Words.Count.ShouldBeEquivalentTo(4);
        }
Exemplo n.º 21
0
        public BedroomConfiguration(
            IDeviceService deviceService,
            IAreaService areaService,
            CCToolsBoardService ccToolsBoardService,
            SynonymService synonymService,
            ActuatorFactory actuatorFactory,
            SensorFactory sensorFactory,
            AutomationFactory automationFactory)
        {
            if (deviceService == null)
            {
                throw new ArgumentNullException(nameof(deviceService));
            }
            if (areaService == null)
            {
                throw new ArgumentNullException(nameof(areaService));
            }
            if (ccToolsBoardService == null)
            {
                throw new ArgumentNullException(nameof(ccToolsBoardService));
            }
            if (synonymService == null)
            {
                throw new ArgumentNullException(nameof(synonymService));
            }
            if (actuatorFactory == null)
            {
                throw new ArgumentNullException(nameof(actuatorFactory));
            }
            if (sensorFactory == null)
            {
                throw new ArgumentNullException(nameof(sensorFactory));
            }
            if (automationFactory == null)
            {
                throw new ArgumentNullException(nameof(automationFactory));
            }

            _deviceService       = deviceService;
            _areaService         = areaService;
            _ccToolsBoardService = ccToolsBoardService;
            _synonymService      = synonymService;
            _actuatorFactory     = actuatorFactory;
            _sensorFactory       = sensorFactory;
            _automationFactory   = automationFactory;
        }
Exemplo n.º 22
0
            public Configuration(
                CCToolsBoardService ccToolsBoardService,
                IPi2GpioService pi2GpioService,
                SynonymService synonymService,
                IAreaService areaService,
                ActuatorFactory actuatorFactory,
                SensorFactory sensorFactory,
                AutomationFactory automationFactory)
            {
                if (ccToolsBoardService == null)
                {
                    throw new ArgumentNullException(nameof(ccToolsBoardService));
                }
                if (pi2GpioService == null)
                {
                    throw new ArgumentNullException(nameof(pi2GpioService));
                }
                if (synonymService == null)
                {
                    throw new ArgumentNullException(nameof(synonymService));
                }
                if (actuatorFactory == null)
                {
                    throw new ArgumentNullException(nameof(actuatorFactory));
                }
                if (sensorFactory == null)
                {
                    throw new ArgumentNullException(nameof(sensorFactory));
                }
                if (automationFactory == null)
                {
                    throw new ArgumentNullException(nameof(automationFactory));
                }

                _ccToolsBoardService = ccToolsBoardService;
                _pi2GpioService      = pi2GpioService;
                _synonymService      = synonymService;
                _areaService         = areaService;
                _actuatorFactory     = actuatorFactory;
                _sensorFactory       = sensorFactory;
                _automationFactory   = automationFactory;
            }
        public PersonalAgentService(
            SynonymService synonymService,
            IComponentService componentService,
            IAreaService areaService,
            IWeatherService weatherService,
            IOutdoorTemperatureService outdoorTemperatureService,
            IOutdoorHumidityService outdoorHumidityService)
        {
            if (synonymService == null) throw new ArgumentNullException(nameof(synonymService));
            if (componentService == null) throw new ArgumentNullException(nameof(componentService));
            if (areaService == null) throw new ArgumentNullException(nameof(areaService));
            if (weatherService == null) throw new ArgumentNullException(nameof(weatherService));
            if (outdoorTemperatureService == null) throw new ArgumentNullException(nameof(outdoorTemperatureService));
            if (outdoorHumidityService == null) throw new ArgumentNullException(nameof(outdoorHumidityService));

            _synonymService = synonymService;
            _componentService = componentService;
            _areaService = areaService;
            _weatherService = weatherService;
            _outdoorTemperatureService = outdoorTemperatureService;
            _outdoorHumidityService = outdoorHumidityService;
        }
Exemplo n.º 24
0
            public Configuration(
                CCToolsBoardService ccToolsBoardService, 
                IPi2GpioService pi2GpioService, 
                SynonymService synonymService, 
                IAreaService areaService,
                ActuatorFactory actuatorFactory,
                SensorFactory sensorFactory,
                AutomationFactory automationFactory)
            {
                if (ccToolsBoardService == null) throw new ArgumentNullException(nameof(ccToolsBoardService));
                if (pi2GpioService == null) throw new ArgumentNullException(nameof(pi2GpioService));
                if (synonymService == null) throw new ArgumentNullException(nameof(synonymService));
                if (actuatorFactory == null) throw new ArgumentNullException(nameof(actuatorFactory));
                if (sensorFactory == null) throw new ArgumentNullException(nameof(sensorFactory));
                if (automationFactory == null) throw new ArgumentNullException(nameof(automationFactory));

                _ccToolsBoardService = ccToolsBoardService;
                _pi2GpioService = pi2GpioService;
                _synonymService = synonymService;
                _areaService = areaService;
                _actuatorFactory = actuatorFactory;
                _sensorFactory = sensorFactory;
                _automationFactory = automationFactory;
            }
Exemplo n.º 25
0
        public async Task TestITISSynonymProcessor()
        {
            var transformer = new ITISSynonymTransformer();

            var itisData = ITISSynonymData();
            var synonyms = new List <Synonym>();

            itisData.ForEach(i => synonyms.Add(transformer.Transform(i)));

            var originRepository   = RepositoryMocks.GetStandardMockOriginRepository(new List <Stores.Origin>());
            var locationRepository = RepositoryMocks.GetStandardMockLocationRepository(new List <Stores.Location>());
            var synonymRepository  = RepositoryMocks.GetStandardMockSynonymRepository(new List <Stores.Synonym>());
            var taxonRepository    = RepositoryMocks.GetStandardMockTaxonRepository(new List <Stores.Taxon>());

            var locationService = new LocationService(locationRepository.Object);
            var originService   = new OriginService(originRepository.Object, locationService);
            var synonymService  = new SynonymService(synonymRepository.Object);
            var taxonService    = new TaxonService(taxonRepository.Object, synonymService);

            var processor = new SynonymProcessor(synonymService, originService, taxonService);

            await processor.InitializeOrigin(transformer.Origin);

            await processor.InitializeTaxons();

            var result = await processor.Process(synonyms);

            result.Count().Should().Be(16);
            result.Count(s => s.Taxon.Kingdom == "Plantae").Should().Be(1);
            result.Count(s => s.Language == "English").Should().Be(10);
            result.Count(s => s.DateUpdated.Year == 2003).Should().Be(3);
            result.Count(s => s.Rank == "Variety").Should().Be(2);
            result.Count(s => s.Taxon.Variety != null).Should().Be(2);
            result.Count(s => s.Taxon.Variety == "paludicola").Should().Be(1);
            result.Select(s => s.Origin).Count().Should().Be(16);
        }
Exemplo n.º 26
0
 public void TestInitialize()
 {
     _synonymService = new SynonymService();
 }
Exemplo n.º 27
0
        public void GetAllTest()
        {
            Mock <ISynonymRepository> mock = new Mock <ISynonymRepository>();

            mock.Setup(m => m.GetAll()).Returns(new List <Models.Synonym.Synonym>()
            {
                new Models.Synonym.Synonym()
                {
                    Term     = "computer",
                    Synonyms = "laptop,notebook"
                },
                new Models.Synonym.Synonym()
                {
                    Term     = "computer",
                    Synonyms = "workstation"
                },
                new Models.Synonym.Synonym()
                {
                    Term     = "computer",
                    Synonyms = "notebook,pc"
                },
                new Models.Synonym.Synonym()
                {
                    Term     = "notebook",
                    Synonyms = "computer,portable-computer"
                }
            });
            SynonymService synonymService = new SynonymService(mock.Object);


            List <SynonymItemViewModel> result = synonymService.GetAllSynonyms().ToList();


            CollectionAssert.AreEquivalent(result.Where(x => x.Term == "computer").Single().Synonyms.ToList(),
                                           new List <string>()
            {
                "laptop",
                "notebook",
                "workstation",
                "pc"
            });
            CollectionAssert.AreEquivalent(result.Where(x => x.Term == "laptop").Single().Synonyms.ToList(),
                                           new List <string>()
            {
                "computer"
            });
            CollectionAssert.AreEquivalent(result.Where(x => x.Term == "notebook").Single().Synonyms.ToList(),
                                           new List <string>()
            {
                "portable-computer",
                "computer"
            });
            CollectionAssert.AreEquivalent(result.Where(x => x.Term == "workstation").Single().Synonyms.ToList(),
                                           new List <string>()
            {
                "computer"
            });
            CollectionAssert.AreEquivalent(result.Where(x => x.Term == "pc").Single().Synonyms.ToList(),
                                           new List <string>()
            {
                "computer"
            });
            CollectionAssert.AreEquivalent(result.Where(x => x.Term == "portable-computer").Single().Synonyms.ToList(),
                                           new List <string>()
            {
                "notebook"
            });
        }