public void ProspectGetProspectsWithOffsetUrlFormedCorrectly() { var mockDataSource = MockRepository.GenerateMock<IWebClient>(); var expectedUrl = Constants.GetProspectWithTimeOffsetUrl; // 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 Prospects(accessToken: Constants.AccessToken) { UserWebClient = mockDataSource }; target.GetProspects(timeOffset: Constants.TimeOffset, orgOffset: Constants.OrgOffset); // Assert mockDataSource.AssertWasCalled(c => c.UploadString( Arg<string>.Matches(actualUrl => actualUrl == expectedUrl), Arg<string>.Is.Anything, Arg<string>.Is.Anything, Arg<string>.Is.Anything)); }
public void ProspectGetProspectsWithTimeOffsetOnlyShouldFail() { var expect = new Prospects(accessToken: Constants.AccessToken); expect.GetProspects(timeOffset: Constants.TimeOffset); }
public void ProspectUnHideAProspectUrlFormedCorrectly() { var mockDataSource = MockRepository.GenerateMock<IWebClient>(); const string data = ""; string expectedUrl = Constants.UnHideAProspectUrl; // 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(data); // Act var target = new Prospects(accessToken: Constants.AccessToken) { UserWebClient = mockDataSource }; target.UnHideAProspect(Constants.ProspectOrganization); // Assert mockDataSource.AssertWasCalled(c => c.UploadString( Arg<string>.Matches(actualUrl => actualUrl == expectedUrl), Arg<string>.Is.Anything, Arg<string>.Is.Anything, Arg<string>.Is.Anything)); }
public void ProspectsSearchForProspectsRequestIsFormedCorrectly() { var mockDataSource = MockRepository.GenerateMock<IWebClient>(); var expectedUrl = Constants.SearchForProspectsUrl; // 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 Prospects(accessToken: Constants.AccessToken) { UserWebClient = mockDataSource }; target.SearchForProspects("city", "Cambridge"); // Assert mockDataSource.AssertWasCalled(c => c.UploadString( Arg<string>.Matches(actualUrl => actualUrl == expectedUrl), Arg<string>.Is.Anything, Arg<string>.Is.Anything, Arg<string>.Is.Anything)); }
public void ProspectsHideAProspectRequestIsFormedCorrectly() { var mockDataSource = MockRepository.GenerateMock<IWebClient>(); const string data = ""; var expectedUrl = Constants.UnHideAProspectUrl; // 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(data); // Act var target = new Prospects(accessToken: Constants.AccessToken) { UserWebClient = mockDataSource }; target.HideAProspect(Encoder.UrlEncode(Constants.ProspectOrganization)); // Assert mockDataSource.AssertWasCalled(c => c.UploadString( Arg<string>.Matches(actualUrl => actualUrl == expectedUrl), Arg<string>.Matches(actualMethod => actualMethod == "POST"), Arg<string>.Matches(actualContentType => actualContentType == "application/x-www-form-urlencoded"), Arg<string>.Matches(actaulData => actaulData == "marriott%20hotel"))); }
public void ProspectsClassInitializes() { var target = new Prospects(apiKey: Constants.ApiKey); Assert.IsNotNull(target); }