Пример #1
0
        public void ValueForAgentShouldInsert()
        {
            repo.Insert(AGENT2);

            var response = db.Agent.Find(1);

            Assert.AreEqual(response.FirstName, "Alexa");
        }
Пример #2
0
        public Agent Add(Agent agent)
        {
            using (IUnitOfWork unitOfWork = context.CreateUnitOfWork())
            {
                int newAgentId = agentRepo.Insert(agent);
                if (newAgentId <= 0)
                {
                    throw new FailedOperationException("Failed to insert Agent.", agent);
                }

                unitOfWork.SaveChanges();
                return(agentRepo.GetById(newAgentId));
            }
        }