Esempio n. 1
0
        public void ProjectRepository_delete_Project_with_a_bug()
        {
            var bug = new Bug {
                Name = "Name Bug", IdStatus = new Guid("00000000-0000-0000-0000-000000000001"), IdPriority = new Guid("00000000-0000-0000-0000-000000000001")
            };

            bug.IdProject = _simpleProject.IdProject;
            _bugRepository.Insert(bug);

            _projectRepository.Delete(_simpleProject.IdProject);
            var expectedProject = _projectRepository.GetById(_simpleProject.IdProject);
            var expectedBug     = _bugRepository.GetById(bug.IdBug);

            Assert.IsNull(expectedProject);
            Assert.IsNull(expectedBug);
        }
        public void BugRepository_should_save_simple_bug()
        {
            _bugRepository.Insert(_bug);
            var expectedBug = _bugRepository.GetById(_bug.IdBug);

            Assert.AreEqual <Bug>(expectedBug, _bug);
        }
Esempio n. 3
0
 public ActionResult <Bug> Get(int id)
 {
     try
     {
         return(Ok(_repo.GetById(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
Esempio n. 4
0
        public IActionResult GetById(int id)
        {
            var bug = _bugRepository.GetById(id);

            if (bug == null)
            {
                return(NotFound());
            }
            var bugDto = _mapper.Map <BugResponseDto>(bug);

            return(Ok(bugDto));
        }