public async Task And_Invalid_StandardId_Then_Returns_Not_Found( string id, [Frozen] Mock <IMediator> mockMediator, [Greedy] TrainingCoursesController controller) { mockMediator .Setup(mediator => mediator.Send( It.IsAny <GetStandardDetailsQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(new GetStandardDetailsResult(null)); var controllerResult = await controller.GetStandardById(id) as NotFoundResult; controllerResult.StatusCode.Should().Be((int)HttpStatusCode.NotFound); }
public async Task Then_Get_Training_Course_From_Mediator( string id, GetStandardDetailsResult mediatorResult, [Frozen] Mock <IMediator> mockMediator, [Greedy] TrainingCoursesController controller) { mockMediator .Setup(mediator => mediator.Send( It.IsAny <GetStandardDetailsQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(mediatorResult); var controllerResult = await controller.GetStandardById(id) as ObjectResult; Assert.IsNotNull(controllerResult); controllerResult.StatusCode.Should().Be((int)HttpStatusCode.OK); var model = controllerResult.Value as GetStandardDetailsResponse; Assert.IsNotNull(model); model.Should().BeEquivalentTo(mediatorResult.StandardDetails); }