コード例 #1
0
        public void ContactPropertyCreateNewCustomPropertydUrlFormedCorrectly()
        {
            var mockDataSource = MockRepository.GenerateMock<IWebClient>();
            var expectedUrl = Constants.CreateNewCustomPropertyUrl;

            // Arrange
            mockDataSource
                .Stub(x => x.UploadString(
                    Arg<string>.Is.Anything, // uri
                    Arg<string>.Is.Anything, // method
                    Arg<string>.Is.Anything, // content-type
                    Arg<string>.Is.Anything  // data
                               ))
                .Return(string.Empty);

            // Act
            var target = new ContactProperty(apiKey: Constants.ApiKey)
            {
                UserWebClient = mockDataSource
            };
            target.CreateNewCustomProperty("newcustomproperty", "");

            // Assert
            mockDataSource.AssertWasCalled(c => c.UploadString(
                uri: Arg<string>.Matches(actualUrl => actualUrl == expectedUrl),
                method: Arg<string>.Is.Anything,
                contentType: Arg<string>.Is.Anything,
                data: Arg<string>.Is.Anything));
        }
コード例 #2
0
 public void ContactPropertyInitializes()
 {
     var target = new ContactProperty(apiKey: Constants.ApiKey);
     Assert.NotNull(target);
 }