public async Task RickNavigation_GetLastNavigationsByRickId()
        {
            var rickRepository       = new Mock <IRepository <Domain.Entities.Rick> >();
            var repositoryNavigation = new Mock <INavigationRepository>();

            var handler = new Mock <RickLastDimensionNavigatedQueryHandle>(repositoryNavigation.Object, rickRepository.Object);

            RickLastDimensionNavigatedQueryRequest query = new RickLastDimensionNavigatedQueryRequest(1);

            var response = await handler.Object.Handle(query, default(CancellationToken));

            Assert.IsType <RickLastDimensionNavigatedQueryResponse>(response);
        }
示例#2
0
        public async Task <IActionResult> GetLastNavigationByRickId([FromServices] IMediator mediator,
                                                                    [FromServices] ILogger <NavigationController> _logger,
                                                                    int rickId)
        {
            try
            {
                _logger.LogInformation($"Get last navigation by rickId: {rickId}");
                var command = new RickLastDimensionNavigatedQueryRequest(rickId);
                var result  = await mediator.Send(command);

                return(Ok(result));
            }
            catch (Exception ex)
            {
                _logger.LogInformation(ex.Message);
                return(BadRequest(StatusCodes.Status400BadRequest));
            }
        }