Exemple #1
0
        public void ReadHeadForAPerson()
        {
            var ft = new FamilySearchSDK(Settings.Default.UserName, Settings.Default.Password, Settings.Default.ApplicationKey,
                                         TestBacking.AppName, TestBacking.AppVersion, Gedcomx.Api.Lite.Environment.Integration);

            // Create a Person
            var gedcomx = new Gx.Gedcomx();

            gedcomx.AddPerson(TestBacking.GetCreateMalePerson());
            var postResults = ft.Post("/platform/tree/persons", JsonConvert.SerializeObject(gedcomx), MediaType.X_GEDCOMX_v1_JSON).Result;

            // Now get the new person.
            string personId = ((string[])postResults.Headers.Location.ToString().Split('/')).Last();
            var    response = ft.Head("/platform/tree/persons/" + personId, MediaType.APPLICATION_JSON).Result;

            Assert.IsTrue(response.StatusCode == HttpStatusCode.OK, "Resonse should indicate header retreived successfully");
        }
Exemple #2
0
        public void GetAPerson()
        {
            var ft = new FamilySearchSDK(Settings.Default.UserName, Settings.Default.Password, Settings.Default.ApplicationKey,
                                         TestBacking.AppName, TestBacking.AppVersion, Gedcomx.Api.Lite.Environment.Integration);

            // Create a Person
            var gedcomx = new Gx.Gedcomx();

            gedcomx.AddPerson(TestBacking.GetCreateMalePerson());
            var postResults = ft.Post("/platform/tree/persons", JsonConvert.SerializeObject(gedcomx), MediaType.X_GEDCOMX_v1_JSON).Result;

            // Now get the new person.
            string personId = ((string[])postResults.Headers.Location.ToString().Split('/')).Last();
            var    response = ft.Get("/platform/tree/persons/" + personId).Result;

            Assert.IsNotNull(response.persons, "resonse should contain a person");
        }
Exemple #3
0
        public void GetAPortrait()
        {
            var ft = new FamilySearchSDK(Settings.Default.UserName, Settings.Default.Password, Settings.Default.ApplicationKey,
                                         TestBacking.AppName, TestBacking.AppVersion, Gedcomx.Api.Lite.Environment.Integration);

            // Create a Person
            var gedcomx = new Gx.Gedcomx();

            gedcomx.AddPerson(TestBacking.GetCreateMalePerson());
            var postResults = ft.Post("/platform/tree/persons", JsonConvert.SerializeObject(gedcomx), MediaType.X_GEDCOMX_v1_JSON).Result;

            // Now get the new person.
            string personId         = ((string[])postResults.Headers.Location.ToString().Split('/')).Last();
            var    portraitResponse = ft.Get($"/platform/tree/persons/{personId}/portrait", MediaType.X_FS_v1_JSON);
            var    portrait         = portraitResponse.Result;

            Assert.IsTrue(postResults.StatusCode == HttpStatusCode.Created, "Portrait should flag the reply as created");
        }