Beispiel #1
0
        public async Task <IList <CountryDto> > GetSupportedCountriesAsync(CancellationToken cxlToken)
        {
            var response = await _dataProvider.GetCountryListAsync(cxlToken);

            if (response == null)
            {
                throw new Exception("Provider Exception");
            }
            return(response.Select(t => new CountryDto {
                CountryCode = t.Code, Name = t.Name
            }).ToList());
        }
Beispiel #2
0
        public async Task GetSupportedCountriesAsync_Should_Correct_Country_List()
        {
            // arrange
            List <CountryResponse> countries = new List <CountryResponse>
            {
                new CountryResponse {
                    Code = "US", Name = "United States"
                },
                new CountryResponse {
                    Code = "IN", Name = "India"
                },
            };

            _mockProvider.GetCountryListAsync(_cxlToken)
            .Returns(Task.FromResult(countries));

            // act
            var result = await _service.GetSupportedCountriesAsync(_cxlToken);

            // assert
            Assert.AreEqual(countries.Count, result.Count);
        }