Esempio n. 1
0
 public void UpdateNullClient()
 {
     using (var db = new EntitesContext())
     {
         clientDAO = new DbClientDAO(db);
         Assert.ThrowsException <ArgumentNullException>(() => clientDAO.Update(null));
     }
 }
Esempio n. 2
0
        public bool Update(Client entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            CheckArgument(entity);

            return(!clientDAO.ContainsDB(entity) ? clientDAO.Update(entity) : false);
        }
Esempio n. 3
0
        public void UpdateNoDBClient()
        {
            Client clientNoDB = new Client
            {
                Id            = 234,
                Name          = "______",
                ContactPerson = "______",
                Address       = "______",
                Phone         = "______",
            };

            using (var db = new EntitesContext())
            {
                ClearTable.Clients(db);
                clientDAO = new DbClientDAO(db);
                clientDAO.Add(CreateNew());

                Assert.IsFalse(clientDAO.Update(clientNoDB));
            }
        }
Esempio n. 4
0
        public void UpdateClient()
        {
            bool update;

            using (var db = new EntitesContext())
            {
                ClearTable.Clients(db);
                clientDAO = new DbClientDAO(db);
                clientDAO.Add(CreateNew());
                update = clientDAO.Update(new Client
                {
                    Id            = 1,
                    Name          = "____",
                    Address       = "____",
                    ContactPerson = "____",
                    Phone         = "____",
                });
            }

            Assert.IsTrue(update);
        }