public void GetByErroneousNumberKeyClient() { using (var db = new EntitesContext()) { clientDAO = new DbClientDAO(db); Assert.ThrowsException <ArgumentException>(() => clientDAO.GetByNumberKey(erroneousId)); } }
public Client GetByNumberKey(int keyInnerId) { if (keyInnerId < 1) { throw new ArgumentException(nameof(keyInnerId)); } return(clientDAO.GetByNumberKey(keyInnerId)); }
public void GetByNumberKeyNoDBClient() { using (var db = new EntitesContext()) { ClearTable.HaspKeys(db); clientDAO = new DbClientDAO(db); Assert.IsNull(clientDAO.GetByNumberKey(2)); } }
public void GetByNumberKeyClient() { Client getByNumberKey; Client actual = CreateListEntities.Clients()[0]; using (var db = new EntitesContext()) { ClearTable.HaspKeys(db); ClearTable.KeyFeatures(db); ClearTable.Clients(db); ClearTable.KeyFeatureClients(db); clientDAO = new DbClientDAO(db); db.HaspKeys.AddRange(CreateListEntities.HaspKeys()); db.KeyFeatures.AddRange(CreateListEntities.KeyFeatures()); db.Clients.AddRange(CreateListEntities.Clients()); db.KeyFeatureClients.AddRange(CreateListEntities.KeyFeatureClients()); db.SaveChanges(); getByNumberKey = clientDAO.GetByNumberKey(1); } Assert.AreEqual(getByNumberKey, actual); }