Ejemplo n.º 1
0
        public async Task GetDatasourcesTest()
        {
            List <NormalizedDatasourceGroupCountry> expected = new List <NormalizedDatasourceGroupCountry> {
                new NormalizedDatasourceGroupCountry(name: "test-name", description: "test-description", coverage: "25%")
            };

            mockServer
            .Given(
                Request.Create()
                .WithPath("/trial/configuration/v1/datasources/Identity Verification/US")
                .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 <NormalizedDatasourceGroupCountry> result = configurationApi.GetDatasources("trial", "Identity Verification", "US");
                Assert.Equal(result, expected);
            }
            catch (ApiException)
            {
                Assert.True(false, "Unexpected ApiException");
            }

            try
            {
                List <NormalizedDatasourceGroupCountry> result = await configurationApi.GetDatasourcesAsync("trial", "Identity Verification", "US");

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