Пример #1
0
        public void TestSearchPersonsWithWarningsAndErrors()
        {
            GedcomxPersonSearchQueryBuilder query = new GedcomxPersonSearchQueryBuilder()
                .Param("givenNameMisspelled", "Israel");
            var state = collection.SearchForPersons(query);

            Assert.IsTrue(state.Warnings.Count > 0);
        }
Пример #2
0
        public void TestSearchPersons()
        {
            GedcomxPersonSearchQueryBuilder query = new GedcomxPersonSearchQueryBuilder()
                .MotherGivenName("Clarissa")
                .FatherSurname("Heaton")
                .MotherSurname("Hoyt")
                .Surname("Heaton")
                .GivenName("Israel")
                .FatherGivenName("Jonathan");

            var state = collection.SearchForPersons(query);

            Assert.DoesNotThrow(() => state.IfSuccessful());
        }
Пример #3
0
        public void TestReadNextPageOfSearchResults()
        {
            GedcomxPersonSearchQueryBuilder query = new GedcomxPersonSearchQueryBuilder()
                .Name("John Smith")
                .BirthDate("1 January 1900")
                .FatherName("Peter Smith");

            PersonSearchResultsState results = collection.SearchForPersons(query);

            var state = (PersonSearchResultsState)results.ReadNextPage();
            Assert.DoesNotThrow(() => state.IfSuccessful());
            PersonState person = state.ReadPerson(results.Results.Entries.FirstOrDefault());

            Assert.IsNotNull(person);
            Assert.DoesNotThrow(() => person.IfSuccessful());
        }
        public void TestSearchForPersonMatches()
        {
            var query = new GedcomxPersonSearchQueryBuilder()
                .FatherSurname("Heaton")
                .SpouseSurname("Cox")
                .Surname("Heaton")
                .GivenName("Israel")
                .BirthPlace("Orderville, UT")
                .DeathDate("29 August 1936")
                .DeathPlace("Kanab, Kane, UT")
                .SpouseGivenName("Charlotte")
                .MotherGivenName("Clarissa")
                .MotherSurname("Hoyt")
                .Gender("Male")
                .BirthDate("30 January 1880")
                .FatherGivenName("Jonathan");
            var state = tree.SearchForPersonMatches(query);

            Assert.DoesNotThrow(() => state.IfSuccessful());
            Assert.AreEqual(HttpStatusCode.OK, state.Response.StatusCode);
        }
        public void TestReadMatchScoresForPersons()
        {
            var query = new GedcomxPersonSearchQueryBuilder()
                .GivenName("GedcomX")
                .Surname("User")
                .Gender("Male")
                .BirthDate("June 1800")
                .BirthPlace("Provo, Utah, Utah, United States")
                .DeathDate("July 14, 1900")
                .DeathPlace("Provo, Utah, Utah, United States");
            var state = tree.SearchForPersonMatches(query);

            Assert.DoesNotThrow(() => state.IfSuccessful());
            Assert.IsNotNull(state.Results);
            Assert.IsNotNull(state.Results.Entries);
            Assert.Greater(state.Results.Entries.Count, 0);
            Assert.Greater(state.Results.Entries[0].Score, 0);
        }
 /// <summary>
 /// Searches for person matches based off the specified query.
 /// </summary>
 /// <param name="query">The query with search parameters to use.</param>
 /// <param name="options">The options to apply before executing the REST API call.</param>
 /// <returns>
 /// A <see cref="PersonMatchResultsState"/> instance containing the REST API response.
 /// </returns>
 /// <remarks>
 /// The REST API may not produce results if the query is lacking in any way. When this occurs, use the <see cref="P:PersonMatchResults.Warnings"/>
 /// collection to determine possible causes. The most common issue is not supplying a sufficient number of search parameters, in which case too
 /// many search results could return.
 /// </remarks>
 public PersonMatchResultsState SearchForPersonMatches(GedcomxPersonSearchQueryBuilder query, params IStateTransitionOption[] options)
 {
     return SearchForPersonMatches(query.Build(), options);
 }