Esempio n. 1
0
        public async Task <ActionResult <BlogPostUpdateViewModel> > Update(int id)
        {
            var command = new UpdateBlogPostQuery()
            {
                Id = id
            };

            return(this.OkOrNotFound(await _mediator.Send(command)));
        }
Esempio n. 2
0
        public async Task UpdateBlogPostQueryHandler_ReturnsBlogAsync()
        {
            var blog = await RequestDbContext.BlogPosts.FirstAsync();

            var query = new UpdateBlogPostQuery()
            {
                Id = blog.Id
            };
            var handler = new UpdateBlogPostQueryHandler(TestContext.CreateHandlerContext <BlogPostUpdateViewModel>(RequestDbContext));

            var result = await handler.Handle(query, CancellationToken.None);

            Assert.NotNull(result);
        }