Example #1
0
        public void TestPersonPhoneQParam()
        {
            SearchConfiguration sConfig = setDefaultSearchConfiguration();
            List <Field>        fields  = new List <Field>();
            var person = new Person(fields);

            SearchAPIRequest  request  = new SearchAPIRequest(phone: "+14152549431", requestConfiguration: sConfig);
            SearchAPIResponse response = request.Send();

            Assert.IsTrue(response.Person != null);

            request  = new SearchAPIRequest(phone: "14152549431", requestConfiguration: sConfig);
            response = request.Send();
            Assert.IsTrue(response.Person != null);

            request  = new SearchAPIRequest(phone: "+14152549431", requestConfiguration: sConfig);
            response = request.Send();
            Assert.IsTrue(response.Person != null);

            request  = new SearchAPIRequest(phone: "+972508915495", requestConfiguration: sConfig);
            response = request.Send();
            Assert.IsTrue(response.PersonsCount == 0);

            request  = new SearchAPIRequest(phone: "4152549431", requestConfiguration: sConfig);
            response = request.Send();
            Assert.IsTrue(response.Person != null);

            //fields.Add(new Phone(raw: "4152549431"));  //Clark Kent #
            //SearchAPIRequest request = new SearchAPIRequest(person: person, requestConfiguration: sConfig);
            //fields.Add(new Phone(countryCode: System.Convert.ToInt32(recIn.CountryCode), number: System.Convert.ToInt64(recIn.PhoneNum)));
        }
Example #2
0
        public void TestPersonPhonePersonSearchNull()
        {
            SearchConfiguration sConfig = setDefaultSearchConfiguration();
            List <Field>        fields  = new List <Field>();

            fields = new List <Field>();
            fields.Add(new Phone(countryCode: null, number: 636117049));
            var person = new Person(fields);
            SearchAPIRequest request = new SearchAPIRequest(person: person, requestConfiguration: sConfig);

            request = new SearchAPIRequest(person: person, requestConfiguration: sConfig);
            SearchAPIResponse response;

            try
            {
                response = request.Send();
                Assert.IsTrue(false); //if it gets this far, it's false;
            }
            catch (SearchAPIError apiError)
            {
                Assert.IsTrue(apiError.Error == "The query does not contain any valid name/username/user_id/phone/email/address to search by");
            }
            catch (System.Net.WebException e)
            { }
            catch (Exception e)
            { }
        }
Example #3
0
        public void TestPersonPhonePersonSearch()
        {
            SearchConfiguration sConfig = setDefaultSearchConfiguration();
            List <Field>        fields  = new List <Field>();

            fields.Add(new Phone(countryCode: 1, number: 4152549431));
            var person = new Person(fields);
            SearchAPIRequest  request  = new SearchAPIRequest(person: person, requestConfiguration: sConfig);
            SearchAPIResponse response = request.Send();

            Assert.IsTrue(response.Person != null);

            fields = new List <Field>();
            fields.Add(new Phone(number: 4152549431));
            person   = new Person(fields);
            request  = new SearchAPIRequest(person: person, requestConfiguration: sConfig);
            response = request.Send();
            Assert.IsTrue(response.Person != null);

            fields = new List <Field>();
            fields.Add(new Phone(countryCode: 34, number: 636117049));
            person   = new Person(fields);
            request  = new SearchAPIRequest(person: person, requestConfiguration: sConfig);
            response = request.Send();
            Assert.IsTrue(response.PersonsCount >= 0);
        }
Example #4
0
        public void TestNotTopMatch()
        {
            SearchConfiguration sConfig = setDefaultSearchConfiguration();
            SearchAPIRequest    s       = new SearchAPIRequest(firstName: "Moshe", lastName: "Elkayam", requestConfiguration: sConfig);
            SearchAPIResponse   res     = s.Send();

            Assert.IsFalse(res.TopMatch);
        }
Example #5
0
        public void TestNotTopMatch()
        {
            SearchConfiguration config = new SearchConfiguration(apiKey: API_KEY);
            SearchAPIRequest    s      = new SearchAPIRequest(firstName: "Moshe", lastName: "Elkayam", requestConfiguration: config);

            SearchAPIResponse res = s.Send();

            Assert.IsFalse(res.TopMatch);
        }
        /// <summary>
        /// Search User's Public SocialMedia profile
        /// </summary>
        /// <param name="email"></param>
        /// <returns>
        /// Return Person object which contains Gender, Jobs, Address...
        /// </returns>
        public async Task <Person> SearchSocailMedia(string email)
        {
            List <Field> fields = new List <Field>()
            {
                new Email(email)
            };
            Person            person   = new Person(fields);
            SearchAPIRequest  request  = new SearchAPIRequest(person: person, requestConfiguration: _searchConfiguration);
            SearchAPIResponse response = await request.SendAsync();

            if (response != null && response.PersonsCount > 0)
            {
                return(response.Person);
            }
            else
            {
                return(null);
            }
        }