public void AddNullKeyFeatureClient() { using (var db = new EntitesContext()) { kfcDAO = new DbKeyFeatureClientDAO(db); Assert.ThrowsException <ArgumentNullException>(() => kfcDAO.Add(null)); } }
public void RemoveNoDBHaspKey() { using (var db = new EntitesContext()) { ClearTable.HaspKeys(db); kfcDAO = new DbKeyFeatureClientDAO(db); kfcDAO.Add(CreateNew()); Assert.IsFalse(kfcDAO.Remove(12)); } }
public void ContainsDBKeyFeatureClient() { var keyFeatCl = CreateNew(); using (var db = new EntitesContext()) { ClearTable.KeyFeatureClients(db); kfcDAO = new DbKeyFeatureClientDAO(db); kfcDAO.Add(keyFeatCl); Assert.IsTrue(kfcDAO.ContainsDB(keyFeatCl)); } }
public void AddKeyFeatureClient() { int idExpected = 1; int add; using (var db = new EntitesContext()) { ClearTable.KeyFeatureClients(db); kfcDAO = new DbKeyFeatureClientDAO(db); add = kfcDAO.Add(CreateNew()); } Assert.AreEqual(idExpected, add); }
public void GetByIdKeyFeatureClient() { KeyFeatureClient getById; KeyFeatureClient kfcExpected = CreateNew(1); using (var db = new EntitesContext()) { ClearTable.KeyFeatureClients(db); kfcDAO = new DbKeyFeatureClientDAO(db); kfcDAO.Add(CreateNew()); getById = kfcDAO.GetById(1); } Assert.AreEqual(getById, kfcExpected); }
public void GetAllKeyFeatureClient() { var getAll = new List <KeyFeatureClient>();; var keyFeatCls = CreateListEntities.KeyFeatureClients(); using (var db = new EntitesContext()) { ClearTable.KeyFeatureClients(db); kfcDAO = new DbKeyFeatureClientDAO(db); foreach (var kfc in keyFeatCls) { kfcDAO.Add(kfc); } getAll = kfcDAO.GetAll(); } CollectionAssert.AreEqual(getAll, keyFeatCls); }
public void UpdateNoDBKeyFeatureClient() { KeyFeatureClient kfcNoDB = new KeyFeatureClient { Id = 345, IdClient = 2354, IdKeyFeature = 23, Initiator = "__", Note = "-++", }; using (var db = new EntitesContext()) { ClearTable.KeyFeatureClients(db); kfcDAO = new DbKeyFeatureClientDAO(db); kfcDAO.Add(CreateNew()); Assert.IsFalse(kfcDAO.Update(kfcNoDB)); } }
public void UpdateKeyFeatureClient() { bool update; using (var db = new EntitesContext()) { ClearTable.KeyFeatureClients(db); kfcDAO = new DbKeyFeatureClientDAO(db); kfcDAO.Add(CreateNew()); update = kfcDAO.Update(new KeyFeatureClient { Id = 1, IdClient = 3, IdKeyFeature = 34, Initiator = "______", Note = "_________", }); } Assert.IsTrue(update); }
public bool Save(KeyFeatureClient entity) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } CheckArgument(entity); int id; if (!keyFeatureClientDAO.ContainsDB(entity)) { id = keyFeatureClientDAO.Add(entity); } else { return(false); } return(id > 0); }