public void RemoveErroneousIdClient()
 {
     using (var db = new EntitesContext())
     {
         clientDAO = new DbClientDAO(db);
         Assert.ThrowsException <ArgumentException>(() => clientDAO.Remove(erroneousId));
     }
 }
Exemple #2
0
        public bool Remove(int id)
        {
            if (id < 1)
            {
                throw new ArgumentException(nameof(id));
            }

            return(clientDAO.Remove(id));
        }
 public void RemoveNoDBClient()
 {
     using (var db = new EntitesContext())
     {
         ClearTable.Clients(db);
         clientDAO = new DbClientDAO(db);
         clientDAO.Add(CreateNew());
         Assert.IsFalse(clientDAO.Remove(123));
     }
 }
        public void RemoveClient()
        {
            bool remove;

            using (var db = new EntitesContext())
            {
                ClearTable.Clients(db);
                ClearTable.KeyFeatureClients(db);

                clientDAO = new DbClientDAO(db);
                db.Clients.AddRange(CreateListEntities.Clients());
                db.KeyFeatureClients.AddRange(CreateListEntities.KeyFeatureClients());
                db.SaveChanges();

                remove = clientDAO.Remove(1);
            }

            Assert.IsTrue(remove);
        }