Exemple #1
0
        public async Task Create_contact_and_get_works()
        {
            if (_apiKey.Equals("demo") && _isAppVeyorEnv)
            {
                Output.WriteLine("Skipping test as the API key is incorrectly set and we're in AppVeyor");
                Assert.True(true);
                return;
            }

            var contact = new ContactHubSpotEntity
            {
                Address   = "Som street 42",
                City      = "Appleseed",
                Company   = "Damage Inc.",
                Email     = $"{Guid.NewGuid():N}@skarp.dk",
                FirstName = "Mr",
                Lastname  = "Tester",
                Phone     = "+45 12345678",
                State     = "",
                ZipCode   = "2300"
            };
            var created = await _client.CreateAsync <ContactHubSpotEntity>(contact);

            Assert.NotNull(created.Id);

            var retrieved = await _client.GetByIdAsync <ContactHubSpotEntity>(created.Id.Value);

            Assert.NotNull(retrieved);
            Assert.Equal("2300", retrieved.ZipCode);
        }
Exemple #2
0
        public async Task ContactClient_update_contact_works()
        {
            var contact = new ContactHubSpotEntity
            {
                Id        = 2340324,
                Email     = "*****@*****.**",
                FirstName = "Da First",
                Lastname  = "Da last"
            };

            await _client.UpdateAsync(contact);
        }
        public RequestDataConverterTest(ITestOutputHelper output) : base(output)
        {
            _converter  = new RequestDataConverter(Logger);
            _contactDto = new ContactHubSpotEntity()
            {
                Address   = "25 First Street",
                City      = "Cambridge",
                Company   = "HubSpot",
                Email     = "*****@*****.**",
                FirstName = "Adrian",
                Lastname  = "Mott",
                Phone     = "555-122-2323",
                State     = "MA",
                Website   = "http://hubspot.com",
                ZipCode   = "02139"
            };

            _customContactDto = new CustomContactHubSpotEntity
            {
                Address      = "25 First Street",
                City         = "Cambridge",
                Company      = "HubSpot",
                Email        = "*****@*****.**",
                FirstName    = "Adrian",
                Lastname     = "Mott",
                Phone        = "555-122-2323",
                State        = "MA",
                Website      = "http://hubspot.com",
                ZipCode      = "02139",
                MyCustomProp = "Has a value!",
                IgnoreMe     = "Even though I have a value! muhahahah"
            };

            _companyDto = new CompanyHubSpotEntity
            {
                Name        = "Acme Inc",
                Description = "The world famous Acme Inc"
            };
        }
Exemple #4
0
        public RequestSerializerTest(ITestOutputHelper output) : base(output)
        {
            _output     = output;
            _serializer =
                new RequestSerializer(new RequestDataConverter(LoggerFactory.CreateLogger <RequestDataConverter>()));
            _contactDto = new ContactHubSpotEntity()
            {
                Address   = "25 First Street",
                City      = "Cambridge",
                Company   = "HubSpot",
                Email     = "*****@*****.**",
                FirstName = "Adrian",
                Lastname  = "Mott",
                Phone     = "555-122-2323",
                State     = "MA",
                Website   = "http://hubspot.com",
                ZipCode   = "02139"
            };

            _companySearch = new CompanySearchByDomain
            {
                Limit  = 2,
                Offset = new CompanySearchOffset
                {
                    CompanyId = 0,
                    IsPrimary = true
                },
                RequestOptions = new CompanySearchRequestOptions
                {
                    Properties = new List <string>
                    {
                        "domain",
                        "createdate",
                        "name",
                        "hs_lastmodifieddate"
                    }
                }
            };
        }
Exemple #5
0
        public async Task Create_contact_and_get_works()
        {
            var contact = new ContactHubSpotEntity
            {
                Address   = "Som street 42",
                City      = "Appleseed",
                Company   = "Damage Inc.",
                Email     = $"{Guid.NewGuid():N}@skarp.dk",
                FirstName = "Mr",
                Lastname  = "Tester",
                Phone     = "+45 12345678",
                State     = "",
                ZipCode   = "2300"
            };
            var created = await _client.CreateAsync <ContactHubSpotEntity>(contact);

            Assert.NotNull(created.Id);

            var retrieved = await _client.GetByIdAsync <ContactHubSpotEntity>(created.Id.Value);

            Assert.NotNull(retrieved);
            Assert.Equal("2300", retrieved.ZipCode);
        }