Exemplo n.º 1
0
        public async Task Properties_are_added_to_queryString([Frozen] IHttpRestClient client, IHubSpotContactClient sut, long contactId, Property[] properties, Contact contact)
        {
            Mock.Get(client)
            .Setup(p => p.SendAsync <Contact>(HttpMethod.Get, $"/contacts/v1/contact/vid/{contactId}/profile", It.IsAny <IQueryString>()))
            .ReturnsAsync(contact)
            .Verifiable();

            var response = await sut.GetByIdAsync(contactId, properties);

            Mock.Get(client)
            .Verify(p => p.SendAsync <Contact>(HttpMethod.Get, $"/contacts/v1/contact/vid/{contactId}/profile", QueryStringMatcher.That(NUnitHelpers.All(properties, property => Does.Contain($"property={property.Name}")))));
        }
Exemplo n.º 2
0
        public async Task Emails_are_attached_to_request([Frozen] IHttpRestClient client, IHubSpotContactClient sut, string[] emails, Dictionary <long, Contact> contacts)
        {
            Mock.Get(client)
            .Setup(p => p.SendAsync <Dictionary <long, Contact> >(HttpMethod.Get, "/contacts/v1/contact/emails/batch/", It.IsAny <IQueryString>()))
            .ReturnsAsync(contacts);

            var response = await sut.GetManyByEmailAsync(emails);

            Mock.Get(client)
            .Verify(p => p.SendAsync <Dictionary <long, Contact> >(HttpMethod.Get, "/contacts/v1/contact/emails/batch/", QueryStringMatcher.That(NUnitHelpers.All(emails, email => Does.Contain($"email={email}")))));
        }