public void UserWasUpdatedAfterPatchRequest()
        {
            string collection = "users";
            var    client     = HttpTool.CreateClient(BaseAddressUri, AcceptHeader);

            AddCleanupAction(() => client.Dispose());
            var newUserId = HttpTool.CreateAndPostRandomUser(BaseAddressUri, AcceptHeader);

            AddCleanupAction(() => HttpTool.DeleteUser(client, newUserId));
            var newUserFromServer = HttpTool.GetUserById(client, newUserId);
            var newUserName       = $"Updated {newUserFromServer.Name}";

            newUserFromServer.Name = newUserName;
            var updatedUser = new User {
                Id = newUserId, Name = newUserName
            };
            string uriRequestPatch = $"api/{collection}/{newUserId}";

            HttpContent   httpContent = HttpTool.ConvertObjectToHttpContent((UserDTO)updatedUser);
            var           httpResponseMessagePatch = HttpTool.MakeRequestToServer(client, HttpMethod.Patch, uriRequestPatch, httpContent);
            Task <string> readTask = HttpTool.ReadContentFromMessage(httpResponseMessagePatch);

            var updatedUserFromServer = HttpTool.GetUserById(client, newUserId);

            Assert.IsTrue(updatedUserFromServer.Equals(newUserFromServer), $"The User in the Response is not the expected one!");
        }
        public void UserWasDeletedAfterDeleteRequest()
        {
            string collection = "users";
            var    client     = HttpTool.CreateClient(BaseAddressUri, AcceptHeader);

            AddCleanupAction(() => client.Dispose());
            var    newUserId        = HttpTool.CreateAndPostRandomUser(BaseAddressUri, AcceptHeader);
            string uriRequestDelete = $"api/{collection}/{newUserId}";

            var           httpResponseMessageDelete = HttpTool.MakeRequestToServer(client, HttpMethod.Delete, uriRequestDelete);
            Task <string> readTask = HttpTool.ReadContentFromMessage(httpResponseMessageDelete);

            var httpResponseMessage = HttpTool.EnsureObjectIsNotFound(client, uriRequestDelete);

            Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.NotFound, $"The User was not deleted as expected!");
        }