public async Task Update() { IUnitDao unitDao = new AdoUnitDao(DefaultConnectionFactory.FromConfiguration(configName)); Unit unit = await unitDao.FindByIdAsync(1); string originalLongName = unit.LongName; unit.LongName = "New long name"; bool update1 = await unitDao.UpdateUnitAsync(unit); Assert.IsTrue(update1); unit = await unitDao.FindByIdAsync(1); Assert.AreEqual(unit.LongName, "New long name"); unit.LongName = originalLongName; bool update2 = await unitDao.UpdateUnitAsync(unit); Assert.IsTrue(update2); unit = await unitDao.FindByIdAsync(1); Assert.AreEqual(unit.LongName, originalLongName); }
public async Task TestFindById() { IUnitDao unitDao = new AdoUnitDao(DefaultConnectionFactory.FromConfiguration(configName)); Unit unit1 = await unitDao.FindByIdAsync(1); Assert.IsNotNull(unit1); Unit unit100 = await unitDao.FindByIdAsync(100); Assert.IsNull(unit100); }