コード例 #1
0
        public async Task GetTestEntitiesTest()
        {
            List <TestEntityDataFields> expected = new List <TestEntityDataFields> {
                new TestEntityDataFields(
                    personInfo: new PersonInfo(
                        firstGivenName: "test-firstGivenName"
                        ),
                    location: new Location(
                        buildingNumber: "test-buildingNumber"
                        ),
                    communication: new Communication(
                        mobileNumber: "test-mobileNumber"
                        )
                    )
            };

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

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

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