Exemple #1
0
 /// <summary>
 /// Constructor for DI
 /// </summary>
 /// <param name="injectedMongoConfig">Config mongoDB connexion (Mandatory)</param>
 /// <param name="logger">Logger (optionnal)</param>
 public MongoDBCountryByContinentByLanguageRepository(
     ILogger <MongoDBCountriesRepository> logger,
     IHRCountryByContinentRepository countryByContinentRepository
     )
 {
     _logger = logger;
     _repo   = countryByContinentRepository;
 }
Exemple #2
0
 public async void MongoDBCountryByContinentByLanguageRepository_GetHRCountriesByContinentByLanguageAsync_With_Iso6391_Param_Null_Or_Empty_Throw_ArgumentNullException(String isoCode)
 {
     IHRCountryByContinentRepository _repo = Substitute.For <IHRCountryByContinentRepository>();
     MongoDBCountryByContinentByLanguageRepository _repoWithNullParams = new MongoDBCountryByContinentByLanguageRepository(null, _repo);
     await Assert.ThrowsAsync <ArgumentNullException>(
         async() =>
     {
         using (Task <IEnumerable <HRCountry> > testTask = _repoWithNullParams.GetHRCountriesByContinentByLanguageAsync(Region.Africa, isoCode))
         {
             await testTask;
         }
     }
         );
 }
Exemple #3
0
        public async void MongoDBCountryByContinentByLanguageRepository_GetHRCountriesByContinentByLanguageAsync_With_countriesWithoutFr_Expect_Empty_Result()
        {
            IHRCountryByContinentRepository _repo = Substitute.For <IHRCountryByContinentRepository>();

            _repo.GetHRCountriesByContinentAsync(Region.Europe).Returns <IEnumerable <HRCountry> >(_countriesWithoutFr);
            MongoDBCountryByContinentByLanguageRepository _mongoRepo = new MongoDBCountryByContinentByLanguageRepository(null, _repo);

            using (Task <IEnumerable <HRCountry> > taskResult = _mongoRepo.GetHRCountriesByContinentByLanguageAsync(Region.Europe, "Fr"))
            {
                await taskResult;
                Assert.NotNull(taskResult.Result);
                List <HRCountry> resultList = taskResult.Result.ToList();
                Assert.Empty(resultList);
            }
        }
 //1- Constructor injection of CountiresRepository
 public CoreCountriesService(
     IHRCoreRepository <HRCountry> countryRepo,
     ILanguageRepository langRepo,
     IServiceWorkflowOnHRCoreRepository <HRCountry> workflow,
     ILogger <CoreCountriesService> logger,
     IHRCountryByContinentRepository countryByContinentRepo,
     IHRCountryByContinentByLanguageRepository continentByLanguageRepo)
 {
     //1-
     _countryRepository       = countryRepo;
     _langRepository          = langRepo;
     _continentByLanguageRepo = continentByLanguageRepo;
     _workflow = workflow;
     if (_workflow != null)
     {
         _workflow.MaxPageSize = _maxPageSize;
     }
     _logger = logger;
     _countryByContinentRepo = countryByContinentRepo;
 }