public void TestReadPreferredSpouseRelationship() { var p = (PersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()).Get(); cleanup.Add(p); var s1 = tree.AddPerson(TestBacking.GetCreateFemalePerson()); cleanup.Add(s1); var s2 = tree.AddPerson(TestBacking.GetCreateFemalePerson()); cleanup.Add(s2); p.AddSpouse(s1); p.AddSpouse(s2); var me = tree.ReadCurrentUser(); var person = tree.ReadPersonById(p.Person.Id); // Ensure the target relationship exists person.LoadSpouseRelationships(); var state = (IPreferredRelationshipState)person.ReadRelationship(person.Entity.Relationships[0]); tree.UpdatePreferredSpouseRelationship(me.User.TreeUserId, p.Person.Id, state); var state2 = (FamilyTreeRelationshipState)tree.ReadPreferredSpouseRelationship(me.User.TreeUserId, p.Person.Id); Assert.AreEqual(HttpStatusCode.SeeOther, state2.Response.StatusCode); Assert.IsNotNull(state2.Headers.Get("Location").Single()); }