コード例 #1
0
        public void Post_Called_BuildsUri()
        {
            // Given
            var request = new UserRequest {
                Item = new User {
                    Name = "Owner Name"
                }
            };
            var userResource = new UserResource(_client.Object);

            // When
            userResource.Post(request);

            // Then
            _client.Setup(b => b.BuildUri(It.IsAny <string>(), ""));
        }
コード例 #2
0
        public void Post_CalledWithUser_ReturnsUserReponse()
        {
            // Given
            var response = new UserResponse {
                Item = new User {
                    Name = "Owner Name"
                }
            };
            var request = new UserRequest {
                Item = new User {
                    Name = "Owner Name"
                }
            };

            _client.Setup(b => b.Post <UserResponse>(It.IsAny <Uri>(), request, "application/json")).Returns(response);
            var userResource = new UserResource(_client.Object);

            // When
            var result = userResource.Post(request);

            // Then
            Assert.That(result, Is.EqualTo(response));
        }
コード例 #3
0
        public void Post_CalledWithUser_ReturnsUserReponse()
        {
            // Given
            var response = new UserResponse { Item = new User { Name = "Owner Name" } };
            var request = new UserRequest { Item = new User { Name = "Owner Name" } };
            _client.Setup(b => b.Post<UserResponse>(It.IsAny<Uri>(), request, "application/json")).Returns(response);
            var userResource = new UserResource(_client.Object);

            // When
            var result = userResource.Post(request);

            // Then
            Assert.That(result, Is.EqualTo(response));
        }
コード例 #4
0
        public void Post_Called_BuildsUri()
        {
            // Given
            var request = new UserRequest { Item = new User { Name = "Owner Name" } };
            var userResource = new UserResource(_client.Object);

            // When
            userResource.Post(request);

            // Then
            _client.Setup(b => b.BuildUri(It.IsAny<string>(), ""));
        }