示例#1
0
        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));
            }
        }
示例#2
0
        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));
            }
        }
示例#3
0
        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);
        }