Пример #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;

                ValidateMailingAddressUSCANAPIRequest  request  = new ValidateMailingAddressUSCANAPIRequest(input, op);
                ValidateMailingAddressUSCANAPIResponse response = identifyAddressService.ValidateMailingAddressUSCAN(request);

                Assert.IsInstanceOfType(response, typeof(ValidateMailingAddressUSCANAPIResponse));
                string output = Utility.ObjectToJson <ValidateMailingAddressUSCANAPIResponse>(response);
                Debug.WriteLine(output);
            }
            catch (Exception e)
            {
                Assert.Fail("Unexpected Exception");
            }
        }
Пример #2
0
        public void getAddressProjsonTestAndCompareSDKResponseTest()
        {
            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;

                ValidateMailingAddressUSCANAPIRequest  request  = new ValidateMailingAddressUSCANAPIRequest(input, op);
                ValidateMailingAddressUSCANAPIResponse response = identifyAddressService.ValidateMailingAddressUSCAN(request);
                string sdkResponse = Utility.ObjectToJson <ValidateMailingAddressUSCANAPIResponse>(response);

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

                Assert.AreEqual(sdkResponse, apiResponse);
            }
            catch (Exception e)
            {
                Assert.Fail("Unexpected Exception");
            }
        }
        /// <summary>
        /// Workflows the completed callback.
        /// </summary>
        /// <param name="results">The results.</param>
        void WorkflowCompletedCallbackValidateAddressUSCAN(IAsyncResult results)
        {
            AsyncResult result = (AsyncResult)results;
            processAPIRequestDelegate <ValidateMailingAddressUSCANAPIResponse> del = (processAPIRequestDelegate <ValidateMailingAddressUSCANAPIResponse>)result.AsyncDelegate;
            WebResponseEventArgs <ValidateMailingAddressUSCANAPIResponse>      webResponceEventArgs;

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