예제 #1
0
 public void UpdateNullKeyFeature()
 {
     using (var db = new EntitesContext())
     {
         kfDAO = new DbKeyFeatureDAO(db);
         Assert.ThrowsException <ArgumentNullException>(() => kfDAO.Update(null));
     }
 }
예제 #2
0
        public bool Update(KeyFeature entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            CheckArgument(entity);

            return(!keyFeatureDAO.ContainsDB(entity) ? keyFeatureDAO.Update(entity) : false);
        }
예제 #3
0
        public void UpdateNoDBKeyFeature()
        {
            var kfNoDB = new KeyFeature
            {
                Id        = 32,
                IdFeature = 3,
                IdHaspKey = 24,
                EndDate   = date.AddDays(100),
                StartDate = date,
            };

            using (var db = new EntitesContext())
            {
                ClearTable.KeyFeatures(db);
                kfDAO = new DbKeyFeatureDAO(db);
                kfDAO.Add(CreateNew());
                Assert.IsFalse(kfDAO.Update(kfNoDB));
            }
        }
예제 #4
0
        public void UpdateKeyFeature()
        {
            bool update;

            using (var db = new EntitesContext())
            {
                ClearTable.KeyFeatures(db);
                kfDAO = new DbKeyFeatureDAO(db);
                kfDAO.Add(CreateNew());

                update = kfDAO.Update(new KeyFeature
                {
                    Id        = 1,
                    IdFeature = 2,
                    IdHaspKey = 3,
                    StartDate = date.AddDays(5),
                    EndDate   = date.AddDays(10),
                });
            }

            Assert.IsTrue(update);
        }