public void UpdateNullKeyFeature() { using (var db = new EntitesContext()) { kfDAO = new DbKeyFeatureDAO(db); Assert.ThrowsException <ArgumentNullException>(() => kfDAO.Update(null)); } }
public bool Update(KeyFeature entity) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } CheckArgument(entity); return(!keyFeatureDAO.ContainsDB(entity) ? keyFeatureDAO.Update(entity) : false); }
public void UpdateNoDBKeyFeature() { var kfNoDB = new KeyFeature { Id = 32, IdFeature = 3, IdHaspKey = 24, EndDate = date.AddDays(100), StartDate = date, }; using (var db = new EntitesContext()) { ClearTable.KeyFeatures(db); kfDAO = new DbKeyFeatureDAO(db); kfDAO.Add(CreateNew()); Assert.IsFalse(kfDAO.Update(kfNoDB)); } }
public void UpdateKeyFeature() { bool update; using (var db = new EntitesContext()) { ClearTable.KeyFeatures(db); kfDAO = new DbKeyFeatureDAO(db); kfDAO.Add(CreateNew()); update = kfDAO.Update(new KeyFeature { Id = 1, IdFeature = 2, IdHaspKey = 3, StartDate = date.AddDays(5), EndDate = date.AddDays(10), }); } Assert.IsTrue(update); }