public async void TestDelete() { ConnectionFactory connectionFactory = new ConnectionFactory(Environment.Testing); ICountryDao countryDao = new CountryDao(connectionFactory); Country country = new Country { Code = "AT" }; country.Id = await countryDao.Insert(country); Assert.NotNull(await countryDao.FindById(country.Id)); await countryDao.Delete(country.Id); Assert.Null(await countryDao.FindById(country.Id)); }
public async void TestFindById() { ConnectionFactory connectionFactory = new ConnectionFactory(Environment.Testing); ICountryDao countryDao = new CountryDao(connectionFactory); Country country = new Country { Code = "AT" }; country.Id = await countryDao.Insert(country); Country countryFound = await countryDao.FindById(country.Id); Assert.Equal(country.Code, countryFound.Code); }
public async void TestUpdate() { ConnectionFactory connectionFactory = new ConnectionFactory(Environment.Testing); ICountryDao countryDao = new CountryDao(connectionFactory); Country country = new Country { Code = "DE" }; country.Id = await countryDao.Insert(country); country.Code = "IT"; await countryDao.Update(country); Country countryAfter = await countryDao.FindById(country.Id); Assert.Equal(country.Code, countryAfter.Code); }