public void Test_StudentIntegration_Delete_ShouldBeOk() { Result resultToDelete = ObjectMother.GetExistentValidResult(_student, _evaluation); _service.Delete(resultToDelete); Result resultFound = _service.Get(resultToDelete.Id); resultFound.Should().BeNull(); }
public void Test_ResultService_Get_ShouldBeOk() { int existentId = 1; _evaluation = ObjectMother.GetExistentValidEvaluation(); _student = ObjectMother.GetExistentValidStudent(); _mockRepository.Setup(sr => sr.Get(existentId)).Returns(ObjectMother.GetExistentValidResult(_student, _evaluation)); Result resultFound = _service.Get(existentId); resultFound.Id.Should().Be(existentId); _mockRepository.Verify(sr => sr.Get(existentId)); }
// GET: Admin/Result/Details/5 public async Task <ActionResult> Details(int id) { try { Result result = await _service.Get(id); if (result == null) { return(HttpNotFound()); } return(View(result)); } catch (ValidationException e) { return(HttpNotFound(e.Message)); } }
public async Task <ActionResult <Result> > GetFromQuestion(Guid questionId) { var question = await _questions.Get(questionId, HttpContext.RequestAborted); if (question == null) { return(NotFound()); } var result = await _results.Get(HttpContext.GetUser(), question, HttpContext.RequestAborted); if (result == null) { return(NoContent()); } return(result); }
public async Task <ActionResult <Result> > Get(long id) { return(await _resultService.Get(id)); }