Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
 public async Task <ActionResult <EditPathResponse> > Edit([FromBody] EditPathCommand command)
 {
     return(Ok(await Mediator.Send(command)));
 }