HubspotAPIWrapper.Contacts.GetAllContacts C# (CSharp) Method

GetAllContacts() public method

public GetAllContacts ( string count = "", string property = "", string contactOffset = "" ) : System.Json.JsonObject
count string
property string
contactOffset string
return System.Json.JsonObject
        public JsonObject GetAllContacts(string count = "", string property = "", string contactOffset = "")
        {
            var optionalParams = new Dictionary<string, string>();
            if (count.Length > 0)
            {
                optionalParams["count"] = count;
            }
            if (property.Length > 0)
            {
                optionalParams["property"] = property;
            }
            if (count.Length > 0)
            {
                optionalParams["vidOffset"] = contactOffset;
            }

            return Call(subpath: "lists/all/contacts/all", optionalParams: optionalParams);
        }

Usage Example

Esempio n. 1
0
        public void ContactsGetAllContactsUrlFormedCorrectly()
        {
            var mockDataSource = MockRepository.GenerateMock<IWebClient>();
            string expectedUrl = Constants.GetAllContactsUrl;

            // 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 Contacts(apiKey: Constants.ApiKey)
            {
                UserWebClient = mockDataSource
            };
            target.GetAllContacts();

            // 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));
        }