public async Task EditPathByAdminNotFound() { var client = await GetAdminClientAsync(); var pet = new EditPathCommand { Id = 7777, Name = "Name to edit" }; var content = Utilities.GetRequestContent(pet); var response = await client.PostAsync("/api/Path/Edit", content); Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); }
public async Task EditPathExcededNameLenghtByAdminBadRequest() { var client = await GetAdminClientAsync(); var pet = new EditPathCommand { Id = 2, Name = "a new path name with a name lenght no valid " }; var content = Utilities.GetRequestContent(pet); var response = await client.PostAsync("/api/Path/Edit", content); Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); }
public async Task EditPathByUserNotAuthorized() { var client = await GetUserClientAsync(); var pet = new EditPathCommand { Id = 1, Name = "newPathName" }; var content = Utilities.GetRequestContent(pet); var response = await client.PostAsync("/api/Path/Edit", content); Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); }
public async Task EditSucessful() { var client = await GetAdminClientAsync(); var pet = new EditPathCommand { Id = 1, Name = "newPathName" }; var content = Utilities.GetRequestContent(pet); var response = await client.PostAsync("/api/Path/Edit", content); response.EnsureSuccessStatusCode(); var result = await Utilities.GetResponseContent <EditPathResponse>(response); Assert.IsType <EditPathResponse>(result); }
public async Task <ActionResult <EditPathResponse> > Edit([FromBody] EditPathCommand command) { return(Ok(await Mediator.Send(command))); }