Exemplo n.º 1
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(TestBacking.GetCreateNote());

            Assert.DoesNotThrow(() => state.IfSuccessful());
            Assert.AreEqual(HttpStatusCode.Created, state.Response.StatusCode);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public void TestReadRelationshipsToChildren()
        {
            var father = (FamilyTreePersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()).Get();

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

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

            cleanup.Add(chapr);
            var state2 = father.LoadChildRelationships();

            Assert.DoesNotThrow(() => state2.IfSuccessful());
            var children = state2.GetChildRelationships();

            Assert.IsNotNull(children);
            Assert.Greater(children.Count, 0);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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);
        }