Ejemplo n.º 1
0
        public async Task GetBusinessRegistrationNumbersTest()
        {
            List <BusinessRegistrationNumber> expected = new List <BusinessRegistrationNumber> {
                new BusinessRegistrationNumber(name: "test-name")
            };

            mockServer
            .Given(
                Request.Create()
                .WithPath("/trial/configuration/v1/businessregistrationnumbers/US/CA")
                .WithHeader("x-trulioo-api-key", TEST_API_KEY)
                .UsingGet()
                )
            .RespondWith(
                Response.Create()
                .WithStatusCode(200)
                .WithHeader("Content-Type", "application/json")
                .WithBody(JsonConvert.SerializeObject(expected))
                );

            try
            {
                List <BusinessRegistrationNumber> result = configurationApi.GetBusinessRegistrationNumbers("trial", "US", "CA");
                Assert.Equal(result, expected);
            }
            catch (ApiException)
            {
                Assert.True(false, "Unexpected ApiException");
            }

            try
            {
                List <BusinessRegistrationNumber> result = await configurationApi.GetBusinessRegistrationNumbersAsync("trial", "US", "CA");

                Assert.Equal(result, expected);
            }
            catch (ApiException)
            {
                Assert.True(false, "Unexpected ApiException");
            }
        }