public void ThenIGetAPIResponseAsUserNotFound()
        {
            var          resturl  = api.SetUrl("api/users/23");
            var          request  = api.CreateRequest();
            var          response = api.GetResponse(resturl, request);
            UserResponse content  = api.GetContent <UserResponse>(response);

            Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode, "404 Not Found");
        }
Beispiel #2
0
        public void ThenIGetAPIResponseInJsonFormat()
        {
            var          resturl  = api.SetUrl("api/users/2");
            var          request  = api.CreateRequest();
            var          response = api.GetResponse(resturl, request);
            UserResponse content  = api.GetContent <UserResponse>(response);

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode, "200 OK");
            Assert.That(content.Data.first_name, Does.Contain("Janet"));
            Assert.That(content.Data.last_name, Does.Contain("Weaver"));
        }
        public void WhenWeCreateAUser()
        {
            var requestBody = new PostUserRequest()
            {
                Name = firstName, Job = job
            };


            var          request  = api.CreatePostRequest <PostUserRequest>(requestBody);
            var          resturl  = api.SetUrl("api/users");
            var          response = api.GetResponse(resturl, request);
            UserResponse content  = api.GetContent <UserResponse>(response);
        }