public void GetByErroneousIdFeaturey() { using (var db = new EntitesContext()) { featureDAO = new DbFeatureDAO(db); Assert.ThrowsException <ArgumentException>(() => featureDAO.GetById(erroneousId)); } }
public Feature GetById(int id) { if (id < 1) { throw new ArgumentException(nameof(id)); } return(featureDAO.GetById(id)); }
public void GetByIdNoDBFeature() { Feature getById; using (var db = new EntitesContext()) { ClearTable.Features(db); featureDAO = new DbFeatureDAO(db); getById = featureDAO.GetById(1); } Assert.IsNull(getById); }
public void GetByIdFeature() { Feature getById; Feature featureExpected = CreateNew(1); using (var db = new EntitesContext()) { ClearTable.Features(db); featureDAO = new DbFeatureDAO(db); featureDAO.Add(CreateNew()); getById = featureDAO.GetById(1); } Assert.AreEqual(getById, featureExpected); }