Beispiel #1
0
        public IActionResult GetById(string id)
        {
            var imageTask = _gameImageService.GetByIdAsync(id).ConfigureAwait(false);
            var image     = imageTask.GetAwaiter().GetResult();

            return(File(image.Content, image.ContentType));
        }
Beispiel #2
0
        public void GetById_CallsService_Always()
        {
            var imageDto = GetGameImageDto();

            A.CallTo(() => _gameImageService.GetByIdAsync(Id))
            .Returns(imageDto);

            _gameImageController.GetById(Id);

            A.CallTo(() => _gameImageService.GetByIdAsync(Id))
            .MustHaveHappenedOnceExactly();
        }
        public async Task Invoke(HttpContext context, IGameImageService gameImageService)
        {
            var path = context.Request.Path.Value;

            if (!path.Contains(ExpectedPath))
            {
                await _next(context);

                return;
            }

            const string id    = "1";
            var          image = await gameImageService.GetByIdAsync(id);

            context.Items["game-image"] = image;

            await _next(context);
        }