コード例 #1
0
        public void Test()
        {
            try
            {
                List <Address> rowList = new List <Address>();

                user_field userfield = new user_field {
                    name = "email", value = "*****@*****.**"
                };
                List <user_field> user_fields = new List <user_field>();
                user_fields.Add(userfield);

                rowList.Add(new Address(user_fields, addressline1: "101 cherry st"));

                List <user_field> user_fieldsample = new List <user_field>();
                rowList.Add(new Address(null, addressline1: "12 yonge st", country: "ca", stateorprovince: "on"));
                options op = new options();

                input input = new input();
                input.AddressList = rowList;

                ValidateMailingAddressAPIRequest  request  = new ValidateMailingAddressAPIRequest(input, op);
                ValidateMailingAddressAPIResponse response = identifyAddressService.ValidateMailingAddress(request);

                Assert.IsInstanceOfType(response, typeof(ValidateMailingAddressAPIResponse));
                string output = Utility.ObjectToJson <ValidateMailingAddressAPIResponse>(response);
                Debug.WriteLine(output);
            }
            catch (Exception e)
            {
                Assert.Fail("Unexpected Exception");
            }
        }
コード例 #2
0
        public void getAddressjsonTestAndCompareSDKResponseTest()
        {
            try
            {
                String inputjsonAddresses = "{\"Input\": {"
                                            + "\"Row\":[{"
                                            + "\"AddressLine1\": \"101 cherry st\","
                                            + "\"Country\": \"us\","
                                            + "\"PostalCode\": \"\""
                                            + "},"
                                            + "{"
                                            + "\"AddressLine1\": \"12 yonge st\","
                                            + "\"City\": \"toronto\","
                                            + "\"Country\": \"ca\","
                                            + "\"StateProvince\": \"on\","
                                            + "\"PostalCode\": \"\""
                                            + "}]}}";

                List <Address> rowList = new List <Address>();

                user_field userfield = new user_field {
                    name = "email", value = "*****@*****.**"
                };
                List <user_field> user_fields = new List <user_field>();
                user_fields.Add(userfield);

                rowList.Add(new Address(null, addressline1: "101 cherry st", country: "us"));

                List <user_field> user_fieldsample = new List <user_field>();
                rowList.Add(new Address(null, addressline1: "12 yonge st", country: "ca", stateorprovince: "on", city: "toronto"));
                options op = new options();

                input input = new input();
                input.AddressList = rowList;

                ValidateMailingAddressAPIRequest  request  = new ValidateMailingAddressAPIRequest(input, op);
                ValidateMailingAddressAPIResponse response = identifyAddressService.ValidateMailingAddress(request);
                string sdkResponse = Utility.ObjectToJson <ValidateMailingAddressAPIResponse>(response);

                String apiResponse = TestUtility.ValidateFromAPI(TEST_URL, "/identifyaddress/v1/rest/validatemailingaddress/", TEST_TOKEN, inputjsonAddresses, com.pb.identify.utils.Utility.contentType.json);

                Assert.AreEqual(sdkResponse, apiResponse);
            }
            catch (Exception e)
            {
                Assert.Fail("Unexpected Exception");
            }
        }
コード例 #3
0
        /// <summary>
        /// Workflows the completed callback.
        /// </summary>
        /// <param name="results">The results.</param>
        void WorkflowCompletedCallbackValidateAddress(IAsyncResult results)
        {
            AsyncResult result = (AsyncResult)results;
            processAPIRequestDelegate <ValidateMailingAddressAPIResponse> del = (processAPIRequestDelegate <ValidateMailingAddressAPIResponse>)result.AsyncDelegate;
            WebResponseEventArgs <ValidateMailingAddressAPIResponse>      webResponceEventArgs;

            try
            {
                Debug.WriteLine(" ValidateMailingAddress SDK Asynchronous function called ");
                ValidateMailingAddressAPIResponse Response = del.EndInvoke(results);
                webResponceEventArgs = new WebResponseEventArgs <ValidateMailingAddressAPIResponse>(Response, null);
                IdentifyAPIRequestFinishedEvent.Invoke(this, webResponceEventArgs);
            }
            catch (SdkException sdkException)
            {
                webResponceEventArgs = new WebResponseEventArgs <ValidateMailingAddressAPIResponse>(null, sdkException);
                IdentifyAPIRequestFinishedEvent.Invoke(this, webResponceEventArgs);
                Trace.WriteLine(sdkException.Message);
            }
        }