Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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 ?? "");
        }