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

            return(clientDAO.GetById(id));
        }
示例#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);
        }
示例#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);
        }