Ejemplo n.º 1
0
 public void GetByErroneousIdClient()
 {
     using (var db = new EntitesContext())
     {
         clientDAO = new DbClientDAO(db);
         Assert.ThrowsException <ArgumentException>(() => clientDAO.GetById(erroneousId));
     }
 }
Ejemplo n.º 2
0
        public Client GetById(int id)
        {
            if (id < 1)
            {
                throw new ArgumentException(nameof(id));
            }

            return(clientDAO.GetById(id));
        }
Ejemplo n.º 3
0
        public void GetByIdNoDBClient()
        {
            Client getById;

            using (var db = new EntitesContext())
            {
                ClearTable.Clients(db);
                clientDAO = new DbClientDAO(db);
                getById   = clientDAO.GetById(1);
            }

            Assert.IsNull(getById);
        }
Ejemplo n.º 4
0
        public void GetByIdClient()
        {
            Client getById;
            Client clientExpected = CreateNew(1);

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

            Assert.AreEqual(getById, clientExpected);
        }