Beispiel #1
0
        public void TestDeletePreferredParentRelationship()
        {
            var father = tree.AddPerson(TestBacking.GetCreateMalePerson());

            cleanup.Add(father);
            var mother = tree.AddPerson(TestBacking.GetCreateFemalePerson());

            cleanup.Add(mother);
            var son = (FamilyTreePersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()).Get();

            cleanup.Add(son);
            var chapr = tree.AddChildAndParentsRelationship(TestBacking.GetCreateChildAndParentsRelationship(father, mother, son));

            cleanup.Add(chapr);
            var me = tree.ReadCurrentUser();

            // Ensure the target relationship exists
            var relationship = ((FamilyTreePersonParentsState)son.ReadParents()).ChildAndParentsRelationships.First();
            var state        = son.ReadChildAndParentsRelationship(relationship);

            tree.UpdatePreferredParentRelationship(me.User.TreeUserId, son.Person.Id, state);

            var state2 = tree.DeletePreferredParentRelationship(me.User.TreeUserId, son.Person.Id);

            Assert.AreEqual(HttpStatusCode.NoContent, state2.Response.StatusCode);
            Assert.IsNotNull(state2.Headers.Get("Content-Location").Single());
        }
Beispiel #2
0
        public void TestReadPersonAncestry()
        {
            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();

            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.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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        public void TestCreateChildAndParentsRelationship()
        {
            var father = collection.AddPerson(TestBacking.GetCreateMalePerson());

            cleanup.Add(father);
            var son = collection.AddPerson(TestBacking.GetCreateMalePerson());

            cleanup.Add(son);
            var state = tree.AddChildAndParentsRelationship(TestBacking.GetCreateChildAndParentsRelationship(father, null, son));

            cleanup.Add(state);

            Assert.DoesNotThrow(() => state.IfSuccessful());
            Assert.AreEqual(System.Net.HttpStatusCode.Created, state.Response.StatusCode);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        public void TestReadParentsOfAPerson()
        {
            var father = tree.AddPerson(TestBacking.GetCreateMalePerson());

            cleanup.Add(father);
            var son = (FamilyTreePersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()).Get();

            cleanup.Add(son);
            var chapr = tree.AddChildAndParentsRelationship(TestBacking.GetCreateChildAndParentsRelationship(father, null, son));

            cleanup.Add(chapr);
            var state2 = son.ReadParents();

            Assert.DoesNotThrow(() => state2.IfSuccessful());
            Assert.IsNotNull(state2.Persons);
            Assert.Greater(state2.Persons.Count, 0);
        }
        public void TestCreateChildAndParentsRelationship()
        {
            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 state = tree.AddChildAndParentsRelationship(TestBacking.GetCreateChildAndParentsRelationship(father, mother, son));

            cleanup.Add(state);

            Assert.DoesNotThrow(() => state.IfSuccessful());
            Assert.AreEqual(HttpStatusCode.Created, state.Response.StatusCode);
        }
        public void TestDeleteChildAndParentsRelationshipSourceReference()
        {
            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 temp = TestBacking.GetCreateChildAndParentsRelationship(father, mother, son);

            temp.AddSource(TestBacking.GetPersonSourceReference());
            var relationship = (ChildAndParentsRelationshipState)tree.AddChildAndParentsRelationship(temp).Get();

            cleanup.Add(relationship);

            var state = relationship.DeleteSourceReference(relationship.SourceReference);

            Assert.DoesNotThrow(() => state.IfSuccessful());
            Assert.AreEqual(HttpStatusCode.NoContent, state.Response.StatusCode);
        }
Beispiel #9
0
        public void TestReadPersonDescendancy()
        {
            var father = (FamilyTreePersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()).Get();

            cleanup.Add(father);
            var son = tree.AddPerson(TestBacking.GetCreateMalePerson());

            cleanup.Add(son);
            var rel1 = tree.AddChildAndParentsRelationship(TestBacking.GetCreateChildAndParentsRelationship(father, null, son));

            cleanup.Add(rel1);
            var state = father.ReadDescendancy();

            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.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(son.Headers.Get("X-ENTITY-ID").Single().Value.ToString(), state.Tree.Root.Children[0].Person.Id);
        }
Beispiel #10
0
        public void TestUpdateChildAndParentsRelationshipNotes()
        {
            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 relationship = (ChildAndParentsRelationshipState)tree.AddChildAndParentsRelationship(TestBacking.GetCreateChildAndParentsRelationship(father, mother, son)).Get();

            cleanup.Add(relationship);
            relationship.AddNote(TestBacking.GetCreateNote());
            var notes = relationship.LoadNotes();
            var state = relationship.UpdateNote(notes.Note);

            Assert.DoesNotThrow(() => state.IfSuccessful());
            Assert.AreEqual(HttpStatusCode.NoContent, state.Response.StatusCode);
        }
        public void TestCreateChildAndParentsRelationshipConclusion()
        {
            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 relationship = (ChildAndParentsRelationshipState)tree.AddChildAndParentsRelationship(TestBacking.GetCreateChildAndParentsRelationship(father, mother, son)).Get();

            cleanup.Add(relationship);
            var state = relationship.AddFatherFact(TestBacking.GetBiologicalParentFact());

            Assert.DoesNotThrow(() => state.IfSuccessful());
            Assert.AreEqual(HttpStatusCode.NoContent, state.Response.StatusCode);
        }
        public void TestReadChildAndParentsRelationshipNotes()
        {
            var father       = (FamilyTreePersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()).Get();
            var mother       = tree.AddPerson(TestBacking.GetCreateFemalePerson());
            var son          = tree.AddPerson(TestBacking.GetCreateMalePerson());
            var relationship = (ChildAndParentsRelationshipState)tree.AddChildAndParentsRelationship(TestBacking.GetCreateChildAndParentsRelationship(father, mother, son)).Get();
            var state        = relationship.LoadNotes();

            Assert.DoesNotThrow(() => state.IfSuccessful());
            Assert.AreEqual(HttpStatusCode.OK, state.Response.StatusCode);
        }
Beispiel #13
0
        public void TestReadChildAndParentsRelationshipChangeHistory()
        {
            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 relationship = (ChildAndParentsRelationshipState)tree.AddChildAndParentsRelationship(TestBacking.GetCreateChildAndParentsRelationship(father, mother, son)).Get();

            cleanup.Add(relationship);
            var state = relationship.ReadChangeHistory();

            Assert.DoesNotThrow(() => state.IfSuccessful());
            Assert.AreEqual(HttpStatusCode.OK, state.Response.StatusCode);
            Assert.IsNotNull(state.Entity);
            Assert.IsNotNull(state.Entity.Entries);
            Assert.Greater(state.Entity.Entries.Count, 0);
        }