public void TestReadPersonDescendancyWithSpecifiedSpouse() { var father = (FamilyTreePersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()).Get(); cleanup.Add(father); var mother = tree.AddPerson(TestBacking.GetCreateFemalePerson()); cleanup.Add(mother); var son = tree.AddPerson(TestBacking.GetCreateMalePerson()); cleanup.Add(son); var rel1 = father.AddSpouse(mother).AddFact(TestBacking.GetMarriageFact()); cleanup.Add(rel1); var rel2 = tree.AddChildAndParentsRelationship(TestBacking.GetCreateChildAndParentsRelationship(father, mother, son)); cleanup.Add(rel2); var state = father.ReadDescendancy(FamilySearchOptions.SpouseId(mother.Headers.Get("X-ENTITY-ID").Single().Value.ToString())); Assert.DoesNotThrow(() => state.IfSuccessful()); Assert.AreEqual(HttpStatusCode.OK, state.Response.StatusCode); Assert.IsNotNull(state.Tree); Assert.IsNotNull(state.Tree.Root); Assert.IsNotNull(state.Tree.Root.Person); Assert.IsNotNull(state.Tree.Root.Spouse); Assert.IsNotNull(state.Tree.Root.Children); Assert.AreEqual(1, state.Tree.Root.Children.Count); Assert.IsNotNull(state.Tree.Root.Children[0].Person); Assert.AreEqual(father.Person.Id, state.Tree.Root.Person.Id); Assert.AreEqual(mother.Headers.Get("X-ENTITY-ID").Single().Value.ToString(), state.Tree.Root.Spouse.Id); Assert.AreEqual(son.Headers.Get("X-ENTITY-ID").Single().Value.ToString(), state.Tree.Root.Children[0].Person.Id); }
public void TestUpdateMatchStatusForPersonRecordMatches() { var collection = FamilySearchOptions.Collection("https://familysearch.org/platform/collections/records"); var person = (FamilyTreePersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()); cleanup.Add(person); var matches = person.ReadMatches(); var state = matches.UpdateMatchStatus(matches.Results.Entries[0], MatchStatus.Accepted, collection); Assert.DoesNotThrow(() => state.IfSuccessful()); Assert.AreEqual(HttpStatusCode.NoContent, state.Response.StatusCode); }
public void TestReadRelationshipsToSpousesWithPersons() { var husband = (PersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()).Get(); cleanup.Add(husband); var wife = tree.AddPerson(TestBacking.GetCreateFemalePerson()); cleanup.Add(wife); husband.AddSpouse(wife); var state2 = husband.LoadSpouseRelationships(FamilySearchOptions.IncludePersons()); Assert.DoesNotThrow(() => state2.IfSuccessful()); Assert.IsNotNull(state2.Entity != null); Assert.IsNotNull(state2.Entity.Persons); Assert.AreEqual(2, state2.Entity.Persons.Count); }
public void TestReadPersonAncestryWithSpecifiedSpouseAndAdditionalPersonAndMarriageDetails() { var grandfather = tree.AddPerson(TestBacking.GetCreateMalePerson()); cleanup.Add(grandfather); var father = tree.AddPerson(TestBacking.GetCreateMalePerson()); cleanup.Add(father); var husband = (FamilyTreePersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()).Get(); cleanup.Add(husband); var wife = tree.AddPerson(TestBacking.GetCreateFemalePerson()); cleanup.Add(wife); var rel1 = husband.AddSpouse(wife).AddFact(TestBacking.GetMarriageFact()); cleanup.Add(rel1); var rel2 = tree.AddChildAndParentsRelationship(TestBacking.GetCreateChildAndParentsRelationship(grandfather, null, father)); cleanup.Add(rel2); var rel3 = tree.AddChildAndParentsRelationship(TestBacking.GetCreateChildAndParentsRelationship(father, null, husband)); cleanup.Add(rel3); husband = tree.ReadPersonById(husband.Person.Id); var state = husband.ReadAncestry(FamilySearchOptions.SpouseId(wife.Headers.Get("X-ENTITY-ID").Single().Value.ToString()), FamilySearchOptions.IncludePersonDetails(), FamilySearchOptions.IncludeMarriageDetails()); Assert.DoesNotThrow(() => state.IfSuccessful()); Assert.AreEqual(HttpStatusCode.OK, state.Response.StatusCode); Assert.IsNotNull(state.Tree); Assert.IsNotNull(state.Tree.Root); Assert.IsNotNull(state.Tree.Root.Mother); Assert.IsNotNull(state.Tree.Root.Mother.Person); Assert.IsNotNull(state.Tree.Root.Mother.Person.DisplayExtension); Assert.IsNotNull(state.Tree.Root.Mother.Person.DisplayExtension.MarriageDate); Assert.IsNotNull(state.Tree.Root.Father); Assert.IsNotNull(state.Tree.Root.Father.Person); Assert.IsNotNull(state.Tree.Root.Father.Father); Assert.IsNotNull(state.Tree.Root.Father.Father.Person); Assert.IsNotNull(state.Tree.Root.Father.Father.Father); Assert.IsNotNull(state.Tree.Root.Father.Father.Father.Person); Assert.IsNotNull(state.Tree.Root.Father.Person.Facts); Assert.IsNotNull(state.Tree.Root.Mother.Person.Facts); Assert.AreEqual(grandfather.GetSelfUri(), state.Tree.Root.Father.Father.Father.Person.GetLink("self").Href); Assert.AreEqual(father.GetSelfUri(), state.Tree.Root.Father.Father.Person.GetLink("self").Href); Assert.AreEqual(husband.GetSelfUri(), state.Tree.Root.Father.Person.GetLink("self").Href); Assert.AreEqual(wife.GetSelfUri(), state.Tree.Root.Mother.Person.GetLink("self").Href); }
public void TestReadPersonPortraitWithDefault() { var person = (FamilyTreePersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()).Get(); cleanup.Add(person); var location = "http://i.imgur.com/d9J0gYA.jpg"; // This is BETA, and does not yet return a state. Test is based exclusively off response data. var response = person.ReadPortrait(FamilySearchOptions.DefaultUri(location)); Assert.IsTrue(!response.HasClientError() && !response.HasServerError()); // NOTE: The READ_PERSON_ID user does not have images, but a default is specified, thus the response should be 307. Assert.AreEqual(HttpStatusCode.TemporaryRedirect, response.StatusCode); Assert.IsTrue(response.Headers.Get("Location").Any()); Assert.IsNotNull(response.Headers.Get("Location").Single().Value); Assert.AreEqual(location, response.Headers.Get("Location").Single().Value.ToString()); }
public void TestReadPersonAncestryAndAdditionalPersonDetails() { var grandfather = tree.AddPerson(TestBacking.GetCreateMalePerson()); cleanup.Add(grandfather); var father = tree.AddPerson(TestBacking.GetCreateMalePerson()); cleanup.Add(father); var son = (FamilyTreePersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()).Get(); cleanup.Add(son); var rel1 = tree.AddChildAndParentsRelationship(TestBacking.GetCreateChildAndParentsRelationship(grandfather, null, father)); cleanup.Add(rel1); var rel2 = tree.AddChildAndParentsRelationship(TestBacking.GetCreateChildAndParentsRelationship(father, null, son)); cleanup.Add(rel2); son = tree.ReadPersonById(son.Person.Id); var state = son.ReadAncestry(FamilySearchOptions.IncludePersonDetails()); Assert.DoesNotThrow(() => state.IfSuccessful()); Assert.AreEqual(HttpStatusCode.OK, state.Response.StatusCode); Assert.IsNotNull(state.Tree); Assert.IsNotNull(state.Tree.Root); Assert.IsNotNull(state.Tree.Root.Person); Assert.IsNotNull(state.Tree.Root.Father); Assert.IsNotNull(state.Tree.Root.Father.Person); Assert.IsNotNull(state.Tree.Root.Father.Father); Assert.IsNotNull(state.Tree.Root.Father.Father.Person); Assert.IsNotNull(state.Tree.Root.Person.Facts); Assert.IsNotNull(state.Tree.Root.Father.Person.Facts); Assert.IsNotNull(state.Tree.Root.Father.Father.Person.Facts); Assert.AreEqual(grandfather.GetSelfUri(), state.Tree.Root.Father.Father.Person.GetLink("self").Href); Assert.AreEqual(father.GetSelfUri(), state.Tree.Root.Father.Person.GetLink("self").Href); Assert.AreEqual(son.GetSelfUri(), state.Tree.Root.Person.GetLink("self").Href); }