public void ItShouldPrintAHumanReadablePersonQuery()
        {
            var q = new PersonQuery("Amelia", "Jessica", "Pond", "Seattle", "WA", "98101");

            var s = q.ToString();
            Console.Out.WriteLine(s);

            Assert.IsTrue(s.StartsWith("PersonQuery"));
            Assert.IsTrue(s.Contains("Amelia"));
            Assert.IsTrue(s.Contains("Jessica"));
            Assert.IsTrue(s.Contains("Pond"));
            Assert.IsTrue(s.Contains("Seattle"));
            Assert.IsTrue(s.Contains("WA"));
            Assert.IsTrue(s.Contains("98101"));
        }
        static void Main(string[] args)
        {
            var apiKey = ExampleUtils.GetApiKey(args);
            var client = new Client(apiKey);
            var query = new PersonQuery
                {
                    FirstName = FirstName,
                    MiddleName = MiddleName,
                    LastName = LastName,
                    City = City,
                    StateCode = StateCode,
                    PostalCode = PostalCode,
                };

            Response<IPerson> response = null;
            try
            {
                response = client.FindPeople(query);

            }
            catch (FindException)
            {
                System.Console.Out.WriteLine("FindPerson lookup for {0}; {1}; {2}; {3}; {4}; {5} failed!", FirstName, MiddleName, LastName, City, StateCode, PostalCode);
            }

            if ((response != null) && (response.IsSuccess))
            {
                var results = response.Results;

                Console.Out.WriteLine( "FindPerson lookup for {0}; {1}; {2}; {3}; {4}; {5} was successful, returning {6} root people objects{7}",
                               FirstName, MiddleName, LastName, City, StateCode, PostalCode, results.Count, System.Environment.NewLine);

                foreach ( var person in results ) {
                    ExampleUtils.DumpPerson( person, 2 );
                    System.Console.Out.WriteLine();
                }
            }

            #if DEBUG
            System.Console.Out.WriteLine("Press the ENTER key to quit...");
            System.Console.In.ReadLine();
            #endif
        }
        public Response<IPerson> SearchProApi(LineItem model)
        {
            var apiKey = ConfigurationManager.AppSettings["api_key"];
            var client = new Client(apiKey);
            var query = new PersonQuery(model.FirstName, null, model.LastName, model.City, model.State, model.PostalCode);
            query.UseHistorical = true;
            query.StreetLine1 = model.StreetAddress1;
            query.StreetLine2 = model.StreetAddress2;
            Response<IPerson> response;
            try
            {
                response = client.FindPeople(query);
            }
            catch (FindException)
            {
                throw new Exception(String.Format("FindPerson lookup for {0} {1} failed!", model.FirstName, model.LastName));
            }

            return response;
        }
 /// <summary>
 /// Executes the given query and returns the response.
 /// </summary>
 /// <param name="query">The query to perform</param>
 /// <returns>The response object</returns>
 public virtual Response<IPerson> FindPeople(PersonQuery query)
 {
     return _personResultFinder.Find(query, this);
 }
            public override Response<IPerson> FindPeople(PersonQuery query)
            {
                if (this.ForceErrorResult)
                {
                    throw new FindException("Stubbed client always errors!");
                }

                var results = new List<IPerson>();
                if (!this.ForceEmptyResult)
                {
                    results.Add(_person);
                }
                return new Response<IPerson>(this, results, GetDictionary(this), _emptyMessages);
            }