示例#1
0
        public async Task CountryNameNotEmptyTest()
        {
            RestCountiesServiceMock.Setup(e => e.GetAsync(It.IsAny <string>())).ReturnsAsync(new Country());

            var result = await Sut.GetAsync(string.Empty).ConfigureAwait(false);

            Assert.NotNull(result);
        }
示例#2
0
        public async Task CountryNameNullTest()
        {
            Country ret = null;

            RestCountiesServiceMock.Setup(e => e.GetAsync(It.IsAny <string>())).ReturnsAsync(ret);

            var result = await Sut.GetAsync(null).ConfigureAwait(false);

            Assert.Null(result);
        }
示例#3
0
        public async Task NoCountriesTest()
        {
            CountriesInMemoryRepositoryMock.Setup(e => e.GetAsync()).ReturnsAsync(new List <string>());
            RestCountiesServiceMock.Setup(e => e.GetAsync()).ReturnsAsync(new List <string>());

            var result = await Sut.GetAsync().ConfigureAwait(false);

            Assert.NotNull(result);
            Assert.False(result.Any());
        }
示例#4
0
        public async Task SingleCountryTest()
        {
            var countryName = "Finland";

            CountriesInMemoryRepositoryMock.Setup(e => e.GetAsync()).ReturnsAsync(new List <string>());
            RestCountiesServiceMock.Setup(e => e.GetAsync()).ReturnsAsync(new List <string> {
                countryName
            });

            var result = await Sut.GetAsync().ConfigureAwait(false);

            Assert.NotNull(result);
            Assert.True(result.Any());
            Assert.Equal(countryName, result.FirstOrDefault());
        }