public async Task CreateCountry() { var databaseSizeBeforeCreate = await _countryRepository.CountAsync(); // Create the Country var response = await _client.PostAsync("/api/countries", TestUtil.ToJsonContent(_country)); response.StatusCode.Should().Be(HttpStatusCode.Created); // Validate the Country in the database var countryList = await _countryRepository.GetAllAsync(); countryList.Count().Should().Be(databaseSizeBeforeCreate + 1); var testCountry = countryList.Last(); testCountry.CountryName.Should().Be(DefaultCountryName); }
public async Task CountAsycTest() { //Arrange ICountryRepository countryRepository = _unitOfWork.Repository.CountryRepository; //Act int count = await countryRepository.CountAsync(); //Assert count.ShouldBe(2); }