public void BuildRequestQueryString_UsesCorrectNames() { var client = new ClearbitClient(Configuration["ClearbitApiKey"]); var enrichmentRequest = new EnrichmentCompanyRequest("nimbleapps.cloud") { CompanyName = "CloudNimble" }; var request = new RestRequest(""); client.BuildRequestQueryString(request, enrichmentRequest, new string[] { }); var prop = typeof(RestRequest).GetProperty("UrlSegments", BindingFlags.NonPublic | BindingFlags.Instance); var getter = prop.GetGetMethod(nonPublic: true); var parameters = (IList)getter.Invoke(request, null); parameters.Should().HaveCount(2); var one = ToDynamic(parameters[1]); ((string)one.Key).Should().Be("domain"); }
public async Task GetEnrichmentCombinedAsync_ReturnsValidResult() { var client = new ClearbitClient(Configuration["ClearbitApiKey"]); var result = await client.GetEnrichmentCombinedAsync(new EnrichmentPersonRequest("*****@*****.**"), true); result.Should().NotBeNull(); result.Content.Should().NotBeNull(); result.Content.Person.Should().NotBeNull(); var person = result.Content.Person; person.Id.Should().NotBeEmpty(); person.Avatar.Should().NotBeNullOrWhiteSpace(); person.Name.Should().NotBeNull(); person.Name.FullName.Should().NotBeNullOrWhiteSpace(); person.Geo.Should().NotBeNull(); person.Geo.City.Should().NotBeNullOrWhiteSpace(); person.Employment.Should().NotBeNull(); person.Employment.Domain.Should().NotBeNullOrWhiteSpace(); person.Gravatar.Should().NotBeNull(); result.Content.Company.Should().NotBeNull(); var company = result.Content.Company; company.Id.Should().NotBeEmpty(); company.Site.Should().NotBeNull(); company.Category.Should().NotBeNull(); company.Tags.Should().NotHaveCount(0); company.Geo.Should().NotBeNull(); company.LinkedIn.Should().NotBeNull(); company.Twitter.Should().NotBeNull(); }