コード例 #1
0
        public async Task GetRecommendedFieldsTest()
        {
            JObject expected = new JObject();

            expected.Add("title", "test-title");
            expected.Add("type", "object");
            JObject expectedProperties = new JObject();

            expectedProperties.Add("PersonInfo", new JObject());
            expected.Add("properties", expectedProperties);

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

            try
            {
                Object result = await configurationApi.GetRecommendedFieldsAsync("trial", "Identity Verification", "US");

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