Ejemplo n.º 1
0
        public async Task ApiCheckPostCanBeUpdatedIntoTheSystem(UpdateMethod updateMethod, int userId, int id, string title, string body)
        {
            var testUpdateData = new Post
            {
                UserId = userId,
                Id     = id,
                Title  = title,
                Body   = body
            };

            HttpResponseMessage updateResponseMessade;

            switch (updateMethod)
            {
            case UpdateMethod.Put:
                updateResponseMessade = await _restClient.PutAsync($"{Routes.Posts}/{id}", testUpdateData);

                break;

            case UpdateMethod.Patch:
                updateResponseMessade = await _restClient.PatchAsync($"{Routes.Posts}/{id}", testUpdateData);

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(updateMethod), updateMethod, null);
            }

            Assert.That(updateResponseMessade.StatusCode, Is.EqualTo(HttpStatusCode.OK));
        }
Ejemplo n.º 2
0
 public async Task GivenUserPatchPostInTheSystemThroughApiRequest(Post updatedPost)
 {
     responseMessage = await _restClient.PatchAsync($"{Routes.Posts}/{updatedPost.Id}", updatedPost);
 }