HubspotAPIWrapper.Prospects.GetProspects C# (CSharp) Méthode

GetProspects() public méthode

public GetProspects ( string timeOffset = "", string orgOffset = "" ) : System.Json.JsonObject
timeOffset string
orgOffset string
Résultat System.Json.JsonObject
        public JsonObject GetProspects(string timeOffset = "", string orgOffset = "")
        {
            if ((timeOffset.Length > 0 && orgOffset.Length <= 0) || (orgOffset.Length > 0 && timeOffset.Length <= 0))
            {
                throw new ArgumentException("Need both Time Offset and Organization Offset");
            }

            var optionalParams = new Dictionary<string, string>();
            if (timeOffset.Length > 0 && orgOffset.Length > 0)
            {
                optionalParams["timeOffset"] = timeOffset;
                optionalParams["orgOffset"] = orgOffset;
            }
            return Call("timeline", optionalParams: optionalParams);
        }

Usage Example

        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));
        }
All Usage Examples Of HubspotAPIWrapper.Prospects::GetProspects