Exemplo n.º 1
0
        public async Task <IActionResult> Get([FromRoute] string id)
        {
            var query  = new GetRecipeQuery(id);
            var result = await Mediator.Send(query);

            return(Ok(result));
        }
Exemplo n.º 2
0
        public void GetRecipeQueryHandler_WithNullRequest_ThrowArgumentNullException()
        {
            GetRecipeQuery request = null;

            Func <Task> result = async() => await Act(request);

            result.Should().ThrowExactly <ArgumentNullException>();
        }
Exemplo n.º 3
0
        public void GetRecipeQueryHandler_WithEmptyIdInRequest_ThrowArgumentException()
        {
            var request = new GetRecipeQuery
            {
                Id = Guid.Empty
            };

            Func <Task> result = async() => await Act(request);

            result.Should().ThrowExactly <ArgumentException>();
        }
Exemplo n.º 4
0
 private async Task <RecipeModel> Act(GetRecipeQuery request)
 {
     return(await new GetRecipeQueryHandler(_context.Object, _mapper.Object)
            .Handle(request));
 }