Exemplo n.º 1
0
        public async Task Then_Gets_GeoPoint_From_Mediator(
            GetGeoPointQueryResult mediatorResult,
            [Frozen] Mock <IMediator> mockMediator,
            [Greedy] LocationsController controller)
        {
            mockMediator
            .Setup(mediator => mediator.Send(
                       It.IsAny <GetGeoPointQuery>(),
                       It.IsAny <CancellationToken>()))
            .ReturnsAsync(mediatorResult);

            var controllerResult = await controller.GetGeopoint("AB1 2CD") as ObjectResult;

            Assert.IsNotNull(controllerResult);
            controllerResult.StatusCode.Should().Be((int)HttpStatusCode.OK);
            var model = controllerResult.Value as GetGeoPointResponse;

            Assert.IsNotNull(model);
            model.GeoPoint.Should().BeEquivalentTo(mediatorResult.GetPointResponse.GeoPoint);
        }