public async Task Create_ShouldReturnsSuccessResult() { var client = factory.GetHttpClient(); var request = new CreateCategory.CreateCategoryCommand() { Name = "TestCategory" }; var response = await client.PostAsJsonAsync("/api/category/", request); response.EnsureSuccessStatusCode(); var responseString = await response.Content.ReadAsStringAsync(); var result = JsonConvert.DeserializeObject <int>(responseString); result.Should().BeGreaterThan(0); }
public async Task <ActionResult <int> > Create([FromBody] CreateCategory.CreateCategoryCommand createCommand) { var response = await Mediator.Send(createCommand); return(Ok(response)); }
public async Task <ActionResult <Category> > CreateCategory(CreateCategory.CreateCategoryCommand command) { return(await Mediator.Send(command)); }