public void TestReadAllMatchStatusTypesPersonRecordMatches() { var person = (FamilyTreePersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()).Get(); cleanup.Add(person); var statuses = new QueryParameter("status", "pending", "accepted", "rejected"); var state = person.ReadMatches(statuses); Assert.DoesNotThrow(() => state.IfSuccessful()); Assert.AreEqual(HttpStatusCode.OK, state.Response.StatusCode); Assert.Greater(state.Results.Entries.Count, 0); }
public void TestReadPersonRecordMatches() { var person = (FamilyTreePersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()).Get(); cleanup.Add(person); var query = new QueryParameter("collection", "https://familysearch.org/platform/collections/records"); var state = person.ReadMatches(query); Assert.DoesNotThrow(() => state.IfSuccessful()); Assert.AreEqual(HttpStatusCode.NoContent, state.Response.StatusCode); Assert.IsNull(state.Results); }
public void TestReadHigherConfidencePersonAcceptedRecordMatches() { var person = (FamilyTreePersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()).Get(); cleanup.Add(person); var statuses = new QueryParameter("status", "accepted"); var confidence = new QueryParameter("confidence", "4"); var state = person.ReadMatches(statuses, confidence); Assert.DoesNotThrow(() => state.IfSuccessful()); Assert.AreEqual(HttpStatusCode.OK, state.Response.StatusCode); Assert.Greater(state.Results.Entries.Count, 0); }
public void TestReadPersonMemoriesByType() { var person = (FamilyTreePersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()).Get(); cleanup.Add(person); var dataSource = new BasicDataSource("Sample Memory", MediaTypes.TEXT_PLAIN_TYPE, Resources.MemoryTXT); person.AddArtifact(dataSource); person = (FamilyTreePersonState)person.Get(); var options = new QueryParameter[] { new QueryParameter("type", "story") }; var state = person.ReadArtifacts(options); Assert.DoesNotThrow(() => state.IfSuccessful()); Assert.AreEqual(HttpStatusCode.OK, state.Response.StatusCode); }
public void TestReadRelationshipsToSpousesWithPersons() { var query = new QueryParameter("persons", ""); var state = collection.ReadPerson(new Uri(READ_PERSON_URI)); var state2 = state.LoadSpouseRelationships(query); Assert.DoesNotThrow(() => state2.IfSuccessful()); Assert.IsNotNull(state2.Entity != null); Assert.IsNotNull(state2.Entity.Persons); Assert.AreEqual(2, state2.Entity.Persons.Count); Assert.AreEqual(HttpStatusCode.OK, state.Response.StatusCode); Assert.AreEqual(HttpStatusCode.OK, state2.Response.StatusCode); }
public void TestReadPersonPortraitWithDefault() { var result = collection.AddPerson(TestBacking.GetCreateMalePerson()); Assert.AreEqual(HttpStatusCode.Created, result.Response.StatusCode); var person = (PersonState)result.Get(); var state = tree.ReadPersonById(person.Person.Id); var location = "http://i.imgur.com/d9J0gYA.jpg"; var options = new QueryParameter("default", location); // This is BETA, and does not yet return a state. Test is based exclusively off response data. var response = state.ReadPortrait(options); 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()); person.Delete(); }