public virtual async Task <Country> Save(Country country) { await _countryRepository.CreateOrUpdateAsync(country); await _countryRepository.SaveChangesAsync(); return(country); }
public async Task GetAllCountries() { // Initialize the database await _countryRepository.CreateOrUpdateAsync(_country); await _countryRepository.SaveChangesAsync(); // Get all the countryList var response = await _client.GetAsync("/api/countries?sort=id,desc"); response.StatusCode.Should().Be(HttpStatusCode.OK); var json = JToken.Parse(await response.Content.ReadAsStringAsync()); json.SelectTokens("$.[*].id").Should().Contain(_country.Id); json.SelectTokens("$.[*].countryName").Should().Contain(DefaultCountryName); }