public void GetByErroneousIdKeyFeaturey() { using (var db = new EntitesContext()) { kfDAO = new DbKeyFeatureDAO(db); Assert.ThrowsException <ArgumentException>(() => kfDAO.GetById(erroneousId)); } }
public KeyFeature GetById(int id) { if (id < 1) { throw new ArgumentException(nameof(id)); } return(keyFeatureDAO.GetById(id)); }
public void GetByIdNoDBKeyFeature() { KeyFeature getById; using (var db = new EntitesContext()) { ClearTable.KeyFeatures(db); kfDAO = new DbKeyFeatureDAO(db); getById = kfDAO.GetById(1); } Assert.IsNull(getById); }
public void GetByIdKeyFeature() { KeyFeature getById; KeyFeature kfExpected = CreateNew(1); using (var db = new EntitesContext()) { ClearTable.KeyFeatures(db); kfDAO = new DbKeyFeatureDAO(db); kfDAO.Add(CreateNew()); getById = kfDAO.GetById(1); } Assert.AreEqual(getById, kfExpected); }