public void ContactsListsAddExistingContactToListUrlFormedCorrectly() { var mockDataSource = MockRepository.GenerateMock<IWebClient>(); var expectedUrl = Constants.AddExistingContactToListUrl; // 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 ContactLists(apiKey: Constants.ApiKey) { UserWebClient = mockDataSource }; target.AddExistingContactToList("2", ""); // 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)); }
public void ContactsListsCreateNewListRequestFormedCorrectly() { var mockDataSource = MockRepository.GenerateMock<IWebClient>(); var expectedUrl = Constants.CreateNewContactListUrl; // 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 ContactLists(apiKey: Constants.ApiKey) { UserWebClient = mockDataSource }; target.CreateContactList(string.Empty); // Assert mockDataSource.AssertWasCalled(c => c.UploadString( uri: Arg<string>.Matches(actualUrl => actualUrl == expectedUrl), method: Arg<string>.Matches(actaulMethed => actaulMethed == "POST"), contentType: Arg<string>.Matches(actaulcontentType => actaulcontentType == "application/json"), data: Arg<string>.Is.Anything)); }
public void ContactListsInitializes() { var target = new ContactLists(apiKey: Constants.ApiKey); Assert.NotNull(target); }