public void ContainsDBFeature() { var feature = CreateNew(); using (var db = new EntitesContext()) { ClearTable.Features(db); featureDAO = new DbFeatureDAO(db); featureDAO.Add(feature); Assert.IsTrue(featureDAO.ContainsDB(feature)); } }
public void NoContainsDBFeature() { var feature = CreateNew(); using (var db = new EntitesContext()) { ClearTable.Features(db); featureDAO = new DbFeatureDAO(db); featureDAO.Add(feature); feature.Name = "adasdsa___"; Assert.IsFalse(featureDAO.ContainsDB(feature)); } }
public bool Save(Feature entity) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } CheckArgument(entity); int id; if (!featureDAO.ContainsDB(entity)) { id = featureDAO.Add(entity); } else { return(false); } return(id > 0); }