コード例 #1
0
 public async void MongoDBCountryByContinentByLanguageRepository_GetHRCountriesByContinentByLanguageAsync_With_Null_Repository_Throw_ArgumentNullException()
 {
     MongoDBCountryByContinentByLanguageRepository _repoWithNullParams = new MongoDBCountryByContinentByLanguageRepository(null, null);
     await Assert.ThrowsAsync <ArgumentNullException>(
         async() =>
     {
         using (Task <IEnumerable <HRCountry> > testTask = _repoWithNullParams.GetHRCountriesByContinentByLanguageAsync(Region.Africa, "Fr"))
         {
             await testTask;
         }
     }
         );
 }
コード例 #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;
         }
     }
         );
 }
コード例 #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);
            }
        }