public void GetByErroneousIdKeyFeatureClient() { using (var db = new EntitesContext()) { kfcDAO = new DbKeyFeatureClientDAO(db); Assert.ThrowsException <ArgumentException>(() => kfcDAO.GetById(erroneousId)); } }
public KeyFeatureClient GetById(int id) { if (id < 1) { throw new ArgumentException(nameof(id)); } return(keyFeatureClientDAO.GetById(id)); }
public void GetByIdNoDBKeyFeatureClient() { KeyFeatureClient getById; using (var db = new EntitesContext()) { ClearTable.KeyFeatureClients(db); kfcDAO = new DbKeyFeatureClientDAO(db); getById = kfcDAO.GetById(1); } Assert.IsNull(getById); }
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); }