Exemple #1
0
        public async Task Then_Gets_Routes_List_From_Mediator(
            GetRoutesQueryResult queryResult,
            [Frozen] Mock <IMediator> mockMediator,
            [Greedy] RoutesController controller)
        {
            mockMediator
            .Setup(mediator => mediator.Send(
                       It.IsAny <GetRoutesQuery>(),
                       It.IsAny <CancellationToken>()))
            .ReturnsAsync(queryResult);

            var controllerResult = await controller.GetList() as OkObjectResult;

            var model = controllerResult.Value as GetRoutesListResponse;

            controllerResult.StatusCode.Should().Be((int)HttpStatusCode.OK);
            model.Routes.Should().BeEquivalentTo(queryResult.Routes);
        }