Exemple #1
0
        public void TestAddDependentProfile()
        {
            string token;
            var    mockWebClient = TokenandWebClientSetup(out token);
            string testEmail     = "test" + Guid.NewGuid() + "@example.com";

            DateTime mockDate = DateTime.UtcNow;

            var mock = new AddPatientProfileRequest
            {
                EmailAddress       = testEmail,
                PatientProfileData = new PatientUpdateRequest {
                    PatientName = "p", LastName = "l", Ethnicity = 1, Gender = "m", Dob = mockDate, Height = "2", Weight = "1"
                },
                PatientMedicalHistoryData = new LegacyMedicalHistoryForm()
            };

            mockWebClient.Setup(x => x.UploadString(new Uri(BaseUri, "v2/familygroups/dependents"), "POST",
                                                    JsonConvert.SerializeObject(mock)))
            .Returns("{\"$id\": \"1\",\"data\": [{\"$id\": \"2\", \"patientId\": \"1429\", \"securityToken\":\"\"}]}");

            var sdk = new PatientProfileApi(Settings.Default.BaseUrl, token, Settings.Default.ApiDeveloperId, Settings.Default.ApiKey,
                                            mockWebClient.Object);
            var result = sdk.AddDependent(mock);

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.Data);
            Assert.IsNotNull(result.Data.FirstOrDefault());
            Assert.IsTrue(result.Data.First().PatientId > 0);
        }
 public ApiResponseV2 <PatientProfileResponse> AddDependent(AddPatientProfileRequest newPatient)
 {
     return(Post <ApiResponseV2 <PatientProfileResponse> >("v2/familygroups/dependents", newPatient));
 }