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); }
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); }
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()); }
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()); }