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); }
public ActionResult <Bug> Get(int id) { try { return(Ok(_repo.GetById(id))); } catch (Exception e) { return(BadRequest(e)); } }
public IActionResult GetById(int id) { var bug = _bugRepository.GetById(id); if (bug == null) { return(NotFound()); } var bugDto = _mapper.Map <BugResponseDto>(bug); return(Ok(bugDto)); }