public async Task NullResultFalse() { var command = new UpdateResultCommand(null); var handler = new UpdateResultHandler(_mock.Object); var result = await handler.Handle(command, CancellationToken.None); Assert.IsFalse(result); }
public async Task HasId_True() { var command = new UpdateResultCommand(new QuizResult() { _id = "1" }); var handler = new UpdateResultHandler(_mock.Object); var result = await handler.Handle(command, CancellationToken.None); Assert.IsTrue(result); }
public async Task <IActionResult> UpdateResult(QuizResult quizResult) { if (quizResult == null) { throw new NullReferenceException("ResultController.UpdateResult: NullReferenceException - quizResult is null " + DateTime.Now); } var command = new UpdateResultCommand(quizResult); var result = await _mediator.Send(command); if (result) { return(Ok()); } return(NotFound()); }