Example #1
0
        public void ContainsDBClient()
        {
            var client = CreateNew();

            using (var db = new EntitesContext())
            {
                ClearTable.Clients(db);
                clientDAO = new DbClientDAO(db);
                clientDAO.Add(client);
                Assert.IsTrue(clientDAO.ContainsDB(client));
            }
        }
Example #2
0
        public bool Save(Client entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            CheckArgument(entity);

            int id;

            if (!clientDAO.ContainsDB(entity))
            {
                id = clientDAO.Add(entity);
            }
            else
            {
                return(false);
            }

            return(id > 0);
        }
Example #3
0
        public void NoContainsDBClient()
        {
            var client = CreateNew();

            using (var db = new EntitesContext())
            {
                ClearTable.Clients(db);
                clientDAO = new DbClientDAO(db);
                clientDAO.Add(client);
                client.Name = "asdasd";
                Assert.IsFalse(clientDAO.ContainsDB(client));
            }
        }