コード例 #1
0
        public void Post_CalledWithItem_ReturnsReponse()
        {
            // Given
            var response = new OrganizationResponse {
                Item = new Organization {
                    Name = "blah blah"
                }
            };
            var request = new OrganizationRequest {
                Item = new Organization {
                    Name = "blah blah"
                }
            };

            _client.Setup(b => b.Post <OrganizationResponse>(
                              It.IsAny <Uri>(),
                              request,
                              "application/json",
                              It.IsAny <string>(),
                              It.IsAny <string>()))
            .Returns(response);

            var resource = new OrganizationResource(_client.Object);

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

            // Then
            Assert.That(result, Is.EqualTo(response));
        }
コード例 #2
0
        public void Post_Called_BuildsUri()
        {
            // Given
            var request = new OrganizationRequest {
                Item = new Organization {
                    Name = "blah blah"
                }
            };
            var resource = new OrganizationResource(_client.Object);

            // When
            resource.Post(request);

            // Then
            _client.Setup(b => b.BuildUri(It.IsAny <string>(), ""));
        }
コード例 #3
0
        public void Post_CalledWithItem_ReturnsReponse()
        {
            // Given
            var response = new OrganizationResponse { Item = new Organization { Name = "blah blah" } };
            var request = new OrganizationRequest { Item = new Organization { Name = "blah blah" } };
            _client.Setup(b => b.Post<OrganizationResponse>(
                It.IsAny<Uri>(), 
                request, 
                "application/json",
                It.IsAny<string>(),
                It.IsAny<string>()))
                .Returns(response);

            var resource = new OrganizationResource(_client.Object);

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

            // Then
            Assert.That(result, Is.EqualTo(response));
        }
コード例 #4
0
        public void Post_Called_BuildsUri()
        {
            // Given
            var request = new OrganizationRequest { Item = new Organization { Name = "blah blah" } };
            var resource = new OrganizationResource(_client.Object);
            
            // When
            resource.Post(request);

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