public async Task <IActionResult> Post([FromBody] CreateProjectCommentCommand command) { // Cadastrar o Projeto // var id = _projectCommentService.Create(inputModel); var id = await _mediator.Send(command); return(CreatedAtAction(nameof(GetById), new { id = id }, command)); }
public async Task InputDataIsOk_Executed_ReturnProjecCommenttId() { //Arrange var projectCommentRepository = new Mock <IProjectCommentRepository>(); // LÁ DO COMMANDS => PROJECTS => CREATEPROJECT var createProjectCommentCommand = new CreateProjectCommentCommand { Content = "Descrição teste", IdProject = 1, IdUser = 1 }; var createProjectCommentCommandHandler = new CreateProjectCommentCommandHandler(projectCommentRepository.Object); //Act await createProjectCommentCommandHandler.Handle(createProjectCommentCommand, new CancellationToken()); //Assert projectCommentRepository.Verify(p => p.AddAsync(It.IsAny <ProjectComment>()), Times.Once); }