public void GetByErroneousIdClient() { using (var db = new EntitesContext()) { clientDAO = new DbClientDAO(db); Assert.ThrowsException <ArgumentException>(() => clientDAO.GetById(erroneousId)); } }
public Client GetById(int id) { if (id < 1) { throw new ArgumentException(nameof(id)); } return(clientDAO.GetById(id)); }
public void GetByIdNoDBClient() { Client getById; using (var db = new EntitesContext()) { ClearTable.Clients(db); clientDAO = new DbClientDAO(db); getById = clientDAO.GetById(1); } Assert.IsNull(getById); }
public void GetByIdClient() { Client getById; Client clientExpected = CreateNew(1); using (var db = new EntitesContext()) { ClearTable.Clients(db); clientDAO = new DbClientDAO(db); clientDAO.Add(CreateNew()); getById = clientDAO.GetById(1); } Assert.AreEqual(getById, clientExpected); }