public async Task DeleteTest() { var countryId = await CountryDao.InsertGetIdAsync(new Country { CountryName = "ABC", CountryCode = "DF" }); await CountryDao.DeleteAsync(countryId.Value); Assert.IsNull(await CountryDao.FindByIdAsync(countryId.Value)); }
public async Task FindByIdTest() { var country = (await CountryDao.FindAllAsync()).First(); var countryById = await CountryDao.FindByIdAsync(country.Id); Assert.AreEqual(country.CountryCode, countryById?.CountryCode); Assert.AreEqual(country.CountryName, countryById?.CountryName); }
public async Task UpdateTest() { var country = (await CountryDao.FindAllAsync()).First(); country.CountryName = "TestABC"; await CountryDao.UpdateAsync(country); var updatedCountry = await CountryDao.FindByIdAsync(country.Id); Assert.AreEqual(country.CountryName, updatedCountry?.CountryName); }
public async Task InsertTest() { var id = await CountryDao.InsertGetIdAsync(new Country { CountryCode = "XY", CountryName = "TestCountry" }); var country = await CountryDao.FindByIdAsync(id.Value); Assert.AreEqual("XY", country?.CountryCode); Assert.AreEqual("TestCountry", country?.CountryName ?? ""); }