public void WhenAllergyInToleranceToHealthVault_ThenValuesEqual()
        {
            var json        = SampleUtil.GetSampleContent("FhirAllergy.json");
            var fhirParser  = new FhirJsonParser();
            var fhirAllergy = fhirParser.Parse <AllergyIntolerance>(json);

            var allergy = fhirAllergy.ToHealthVault();

            Assert.IsNotNull(allergy);
            Assert.AreEqual(new Guid("1c855ac0-892a-4352-9a82-3dcbd22bf0bc"), allergy.Key.Id);
            Assert.AreEqual(new Guid("706ceafa-d506-43a8-9758-441fd9c3d407"), allergy.Key.VersionStamp);
            Assert.AreEqual(fhirAllergy.Code.Text, allergy.Name.Text);
            Assert.AreEqual(fhirAllergy.Code.Coding[0].Code, allergy.Name[0].Value);
            Assert.AreEqual(fhirAllergy.Code.Coding[0].System, allergy.Name[0].Family);
            Assert.AreEqual("animal", allergy.AllergenType.Text);
            Assert.AreEqual("39579001", allergy.Reaction[0].Value);
            Assert.AreEqual("Anaphylactic reaction", allergy.Reaction.Text);
            Assert.AreEqual(2004, allergy.FirstObserved.ApproximateDate.Year);
            Assert.AreEqual(false, allergy.IsNegated.Value);
            Assert.AreEqual("Hotwatertreament", allergy.Treatment.Text);
            Assert.AreEqual("animal", allergy.AllergenCode.Text);
            Assert.AreEqual("wc", allergy.AllergenCode[0].Family);
            Assert.AreEqual("animal", allergy.AllergenCode[0].Value);
            Assert.AreEqual("1", allergy.AllergenCode[0].Version);
            Assert.IsNotNull(allergy.TreatmentProvider);
            Assert.AreEqual("John Doe", allergy.TreatmentProvider.Name.ToString());
            Assert.AreEqual("1 Back Lane", allergy.TreatmentProvider.ContactInformation.Address[0].Street[0]);
            Assert.AreEqual("Holmfirth", allergy.TreatmentProvider.ContactInformation.Address[0].City);
            Assert.AreEqual("HD7 1HQ", allergy.TreatmentProvider.ContactInformation.Address[0].PostalCode);
            Assert.AreEqual("UK", allergy.TreatmentProvider.ContactInformation.Address[0].Country);
        }
        public void WhenFhirSleepJournalAMTransformedToHealthVault_ThenValuesEqual()
        {
            var json = SampleUtil.GetSampleContent("FhirSleepJournalAM.json");

            var fhirParser  = new FhirJsonParser();
            var observation = fhirParser.Parse <Observation>(json);

            var sleepJournalAm = observation.ToHealthVault() as SleepJournalAM;

            Assert.IsNotNull(sleepJournalAm);

            Assert.AreEqual(new ApproximateTime(22, 30, 0, 900), sleepJournalAm.Bedtime);
            Assert.AreEqual(new ApproximateTime(6, 28, 59, 182), sleepJournalAm.WakeTime);
            Assert.AreEqual(100, sleepJournalAm.SleepMinutes);
            Assert.AreEqual(110, sleepJournalAm.SettlingMinutes);
            Assert.AreEqual(WakeState.Tired, sleepJournalAm.WakeState);
            Assert.AreEqual(1, sleepJournalAm.Medications.Count);
            Assert.AreEqual("ccabbac8-58f0-4e88-a1eb-538e21e7524d", sleepJournalAm.Medications[0].Value);
            Assert.AreEqual("Mayo", sleepJournalAm.Medications[0].VocabularyName);
            Assert.AreEqual(2, sleepJournalAm.Awakenings.Count);
            Assert.AreEqual(new ApproximateTime(23, 30, 0, 0), sleepJournalAm.Awakenings[0].When);
            Assert.AreEqual(40, sleepJournalAm.Awakenings[0].Minutes);
            Assert.AreEqual(new ApproximateTime(0, 30, 0, 0), sleepJournalAm.Awakenings[1].When);
            Assert.AreEqual(10, sleepJournalAm.Awakenings[1].Minutes);
        }
        public void WhenMultipleFhirObservationsTransformedToHealthVault_TheValuesEqual()
        {
            var fhirParse = new FhirJsonParser();

            var samples = new List <string>()
            {
                SampleUtil.GetSampleContent("FhirBloodGlucose.json"),
                SampleUtil.GetSampleContent("FhirWeight.json"),
                SampleUtil.GetSampleContent("FhirHeight.json"),
            };

            var list = new List <ThingBase>();

            foreach (var sample in samples)
            {
                list.Add(fhirParse.Parse <Observation>(sample).ToHealthVault());
            }

            Assert.AreEqual(3, list.Count);

            Assert.AreEqual(BloodGlucose.TypeId, list[0].TypeId);
            Assert.IsTrue(list[0] is BloodGlucose);

            Assert.AreEqual(Weight.TypeId, list[1].TypeId);
            Assert.IsTrue(list[1] is Weight);

            Assert.AreEqual(Height.TypeId, list[2].TypeId);
            Assert.IsTrue(list[2] is Height);
        }
        public void WhenHealthVaultCdaToFhirToHealthVault_ThenValuesEqual()
        {
            string inputCdaXmlRaw = SampleUtil.GetSampleContent("CDA.xml");

            XPathDocument xpDoc = DocumentReferenceHelper.GetXPathDocumentFromXml(inputCdaXmlRaw);

            CDA inputCda = new CDA();

            inputCda.TypeSpecificData = xpDoc;

            var documentReference = inputCda.ToFhir() as DocumentReference;

            var cda = documentReference.ToHealthVault() as CDA;

            XPathDocument cdaXPathDoc = DocumentReferenceHelper.GetXPathDocumentFromXml(inputCdaXmlRaw) ?? throw new Exception("Invalid XML");

            // XML gets generated using a common method in order to use in Assert.AreEqual
            string inputCdaXml = DocumentReferenceHelper.GetXmlFromXPathNavigator(cdaXPathDoc.CreateNavigator());

            Assert.IsNotNull(cda);
            Assert.IsNotNull(cda.TypeSpecificData);

            string cdaXml = DocumentReferenceHelper.GetXmlFromXPathNavigator(cda.TypeSpecificData.CreateNavigator());

            Assert.AreEqual(inputCdaXml, cdaXml);
        }
        public void WhenFhirCdaTransformedToHealthVault_ThenValuesEqual()
        {
            var json = SampleUtil.GetSampleContent("FhirCDA.json");

            var fhirParser        = new FhirJsonParser();
            var documentReference = fhirParser.Parse <DocumentReference>(json);

            string fhirAttachmentDataBase64Encoded = JObject.Parse(json)["content"][0]["attachment"]["data"].ToString();

            string fhirXmlRaw = Encoding.UTF8.GetString(Convert.FromBase64String(fhirAttachmentDataBase64Encoded));

            XPathDocument fhirXPathDoc = DocumentReferenceHelper.GetXPathDocumentFromXml(fhirXmlRaw) ?? throw new Exception("Invalid XML");

            // XML gets generated using a common method in order to use in Assert.AreEqual
            string fhirXml = DocumentReferenceHelper.GetXmlFromXPathNavigator(fhirXPathDoc.CreateNavigator());

            var cda = documentReference.ToHealthVault() as CDA;

            Assert.IsNotNull(cda);
            Assert.IsNotNull(cda.TypeSpecificData);

            string cdaXml = DocumentReferenceHelper.GetXmlFromXPathNavigator(cda.TypeSpecificData.CreateNavigator());

            Assert.AreEqual(fhirXml, cdaXml);
        }
        public void WhenHealthVaultCcrTransformedToFhir_ThenValuesEqual()
        {
            string        cdaXmlRaw = SampleUtil.GetSampleContent("CCR.xml");
            XPathDocument xpDoc     = DocumentReferenceHelper.GetXPathDocumentFromXml(cdaXmlRaw);

            CCR ccr = new CCR();

            ccr.TypeSpecificData = xpDoc;

            var documentReference = ccr.ToFhir() as DocumentReference;

            Assert.IsNotNull(documentReference);
            Assert.IsNotNull(documentReference.Type);
            Assert.AreEqual(documentReference.Content.Count, 1);
            Assert.IsNotNull(documentReference.Content[0].Attachment);
            Assert.IsNotNull(documentReference.Content[0].Attachment.Data);
            Assert.IsNotNull(documentReference.Content[0].Attachment.ContentType, "application/xml");

            string ccrXml = DocumentReferenceHelper.GetXmlFromXPathNavigator(ccr.TypeSpecificData.CreateNavigator());
            string ccrContentBase64Encoded = Convert.ToBase64String(Encoding.UTF8.GetBytes(ccrXml));

            string fhirAttachmentDataBase64Encoded = Convert.ToBase64String(documentReference.Content[0].Attachment.Data);

            Assert.AreEqual(fhirAttachmentDataBase64Encoded, ccrContentBase64Encoded);
        }
        public void WhenConditionToHealthVault_ThenValuesEqual()
        {
            var json          = SampleUtil.GetSampleContent("FhirCondition.json");
            var fhirParser    = new FhirJsonParser();
            var fhirCondition = fhirParser.Parse <Condition>(json);
            var cd            = fhirCondition.ToHealthVault();

            Assert.IsNotNull(cd);
            Assert.AreEqual("Acute renal insufficiency specified as due to procedure", cd.Name.Text);
            Assert.AreEqual(2, cd.Name.Count);
            Assert.AreEqual("36225005", cd.Name[0].Value);
            Assert.AreEqual("1148", cd.Name[1].Value);
            Assert.AreEqual("Mayo", cd.Name[1].Family);
            Assert.AreEqual("MayoConditions", cd.Name[1].VocabularyName);
            Assert.AreEqual("1.0", cd.Name[1].Version);
            Assert.AreEqual(new HVItemTypes.ApproximateDateTime()
            {
                ApproximateDate = new HVItemTypes.ApproximateDate(2013, 03, 11)
            }, cd.OnsetDate);
            Assert.AreEqual("In Control", cd.StopReason);
            Assert.AreEqual("intermittent", cd.Status.Text);
            Assert.AreEqual("The patient is anuric.The patient state is critcal.", cd.CommonData.Note);
            Assert.AreEqual(new HVItemTypes.ApproximateDateTime()
            {
                ApproximateDate = new HVItemTypes.ApproximateDate(2015)
            }, cd.StopDate);
        }
示例#8
0
        public void WhenExampleFhirImmunizationToHealthVaultImmunization_ThenValuesEqual()
        {
            var json = SampleUtil.GetSampleContent("FhirImmunization.json");

            var fhirParser       = new FhirJsonParser();
            var fhirImmunization = fhirParser.Parse <Immunization>(json);

            var hvImmunization = fhirImmunization.ToHealthVault();

            Assert.IsNotNull(hvImmunization);
            Assert.AreEqual("Fluvax (Influenza)", hvImmunization.Name.Text);
            Assert.IsNotNull(hvImmunization.DateAdministrated.ApproximateDate);
            Assert.AreEqual(2013, hvImmunization.DateAdministrated.ApproximateDate.Year);
            Assert.IsNotNull(hvImmunization.DateAdministrated.ApproximateDate.Month);
            Assert.AreEqual(1, hvImmunization.DateAdministrated.ApproximateDate.Month.Value);
            Assert.IsNotNull(hvImmunization.DateAdministrated.ApproximateDate.Day);
            Assert.AreEqual(10, hvImmunization.DateAdministrated.ApproximateDate.Day.Value);
            Assert.AreEqual("Injection, intramuscular", hvImmunization.Route.Text);
            Assert.AreEqual("Notes on adminstration of vaccine", hvImmunization.CommonData.Note);
            Assert.AreEqual("AAJN11K", hvImmunization.Lot);
            Assert.IsNotNull(hvImmunization.ExpirationDate);
            Assert.AreEqual(2015, hvImmunization.ExpirationDate.Year);
            Assert.IsNotNull(hvImmunization.ExpirationDate.Month);
            Assert.AreEqual(2, hvImmunization.ExpirationDate.Month.Value);
            Assert.IsNotNull(hvImmunization.ExpirationDate.Day);
            Assert.AreEqual(15, hvImmunization.ExpirationDate.Day.Value);
            Assert.AreEqual("left arm", hvImmunization.AnatomicSurface.Text);

            Assert.IsNull(hvImmunization.Administrator);
            Assert.IsNull(hvImmunization.Manufacturer);
        }
        public void WhenFhirExerciseTransformedToHealthVault_ThenValuesEqual()
        {
            var json = SampleUtil.GetSampleContent("FhirExercise.json");

            var fhirParser  = new FhirJsonParser();
            var observation = fhirParser.Parse <Observation>(json);

            var exercise = observation.ToHealthVault() as Exercise;

            Assert.IsNotNull(exercise);
            Assert.AreEqual("Swimming", exercise.Activity.Text);
            Assert.AreEqual(2, exercise.Details.Count);
            Assert.IsNotNull(exercise.Details["lap 1"]);
            Assert.AreEqual("swimming", exercise.Details["lap 1"].Name.Value);
            Assert.AreEqual(30, exercise.Details["lap 1"].Value.Value);
            Assert.AreEqual("seconds", exercise.Details["lap 1"].Value.Units.Text);
            Assert.AreEqual(1, exercise.Segments.Count);
            Assert.AreEqual("Segment 1", exercise.Segments[0].Title);
            Assert.AreEqual(180, exercise.Segments[0].Duration);
            Assert.AreEqual(31.5, exercise.Segments[0].Distance.Meters);
            Assert.AreEqual(43.3, exercise.Segments[0].Offset);
            Assert.AreEqual(2, exercise.Segments[0].Details.Count);
            Assert.IsNotNull(exercise.Segments[0].Details["segment 1 - lap 1"]);
            Assert.AreEqual(46.2, exercise.Segments[0].Details["segment 1 - lap 1"].Value.Value);
            Assert.AreEqual(10, exercise.Duration);
            Assert.AreEqual(30, exercise.Distance.Meters);
        }
示例#10
0
        public void WhenFhirProcedureToHealthVaultProcedure_ThenValuesEqual()
        {
            var json = SampleUtil.GetSampleContent("FhirProcedure.json");

            var fhirParser    = new FhirJsonParser();
            var fhirProcedure = fhirParser.Parse <Procedure>(json);

            var hvProcedure = fhirProcedure.ToHealthVault() as ItemTypes.Procedure;

            Assert.IsNotNull(hvProcedure);
            //when
            Assert.AreEqual(2013, hvProcedure.When.ApproximateDate.Year);
            Assert.AreEqual(1, hvProcedure.When.ApproximateDate.Month);
            Assert.AreEqual(28, hvProcedure.When.ApproximateDate.Day);
            Assert.AreEqual(13, hvProcedure.When.ApproximateTime.Hour);
            Assert.AreEqual(31, hvProcedure.When.ApproximateTime.Minute);
            Assert.AreEqual(00, hvProcedure.When.ApproximateTime.Second);

            //name
            Assert.AreEqual("Chemotherapy", hvProcedure.Name.Text);

            //primary-provider
            Assert.AreEqual("Adam", hvProcedure.PrimaryProvider.Name.First);
            Assert.AreEqual("Careful", hvProcedure.PrimaryProvider.Name.Last);
            Assert.AreEqual("Certified Medical Assistant", hvProcedure.PrimaryProvider.ProfessionalTraining);

            //secondary-provider
            Assert.AreEqual("Dokter Bronsig", hvProcedure.SecondaryProvider.Name.Full);

            //body-site
            Assert.AreEqual("Sphenoid bone", hvProcedure.AnatomicLocation.Text);
        }
        private static Observation GetObservation(string fileName)
        {
            var json = SampleUtil.GetSampleContent(fileName);

            var fhirParser  = new FhirJsonParser();
            var observation = fhirParser.Parse <Observation>(json);

            return(observation);
        }
示例#12
0
        public void WhenFhirHeartRateTransformedToHealthVault_ThenValuesEqual()
        {
            var json = SampleUtil.GetSampleContent("FhirHeartRate.json");

            var fhirParser  = new FhirJsonParser();
            var observation = fhirParser.Parse <Observation>(json);

            var heartRate = observation.ToHealthVault() as HeartRate;

            Assert.IsNotNull(heartRate);
            Assert.AreEqual(44, heartRate.Value);
        }
        public void WhenFhirBodyDimensionTransformedToHealthvault_ThenValuesEqual()
        {
            var json = SampleUtil.GetSampleContent("FhirBodyDimension.json");

            var fhirParser  = new FhirJsonParser();
            var observation = fhirParser.Parse <Observation>(json);

            var bodyDimension = observation.ToHealthVault() as BodyDimension;

            Assert.IsNotNull(bodyDimension);
            Assert.AreEqual(0.15, bodyDimension.Value.Meters);
            Assert.AreEqual("Left bicep size", bodyDimension.MeasurementName.Text);
        }
示例#14
0
        public void WhenBloodPressureToHealthVault_ThenValuesEqual()
        {
            var json = SampleUtil.GetSampleContent("FhirBloodPressure.json");

            var fhirParser  = new FhirJsonParser();
            var observation = fhirParser.Parse <Observation>(json);

            var bp = observation.ToHealthVault() as BloodPressure;

            Assert.IsNotNull(bp);
            Assert.AreEqual(107, bp.Systolic);
            Assert.AreEqual(60, bp.Diastolic);
            Assert.IsNull(bp.Pulse);
        }
示例#15
0
        public void WhenBodyCompositionToHealthVault_ThenValuesEqual()
        {
            var json = SampleUtil.GetSampleContent("FhirBodyComposition.json");

            var fhirParser  = new FhirJsonParser();
            var observation = fhirParser.Parse <Observation>(json);

            var bodyComposition = observation.ToHealthVault() as BodyComposition;

            Assert.IsNotNull(bodyComposition);
            Assert.AreEqual(bodyComposition.Site.Text, "Trunk");
            Assert.AreEqual(bodyComposition.MeasurementMethod.Text, "DXA/DEXA");
            Assert.AreEqual(bodyComposition.MeasurementName.Text, "Body fat percentage");
            Assert.AreEqual(bodyComposition.Value.MassValue.Kilograms, 10);
            Assert.AreEqual(bodyComposition.Value.PercentValue, 0.15);
        }
        public void WhenFhirDocumentReferenceTransformedToHealthVault_ThenEffectiveDateIsSet()
        {
            var json = SampleUtil.GetSampleContent("FhirFile.json");

            var fhirParser        = new FhirJsonParser();
            var documentReference = fhirParser.Parse <DocumentReference>(json);

            var thing = documentReference.ToHealthVault() as ThingBase;

            Assert.IsNotNull(thing);
            Assert.IsNotNull(thing.EffectiveDate);

            var indexed = documentReference.Indexed.Value;
            var indexedLocalDateTime = new NodaTime.LocalDateTime(indexed.Year, indexed.Month, indexed.Day, indexed.Hour, indexed.Minute, indexed.Second);

            Assert.AreEqual(thing.EffectiveDate.Value, indexedLocalDateTime);
        }
        public void WhenFhirFileTransformedToHealthVault_ThenValuesEqual()
        {
            var json = SampleUtil.GetSampleContent("FhirFile.json");

            var fhirParser        = new FhirJsonParser();
            var documentReference = fhirParser.Parse <DocumentReference>(json);

            var file = documentReference.ToHealthVault() as File;

            Assert.IsNotNull(file);
            Assert.IsNotNull(file.ContentType);
            Assert.AreEqual(file.ContentType.ToString(), documentReference.Content[0].Attachment.ContentType);

            string fhirAttachmentDataBase64Encoded = JObject.Parse(json)["content"][0]["attachment"]["data"].ToString();
            string hvFileContentBase64Encoded      = Convert.ToBase64String(file.Content);

            Assert.AreEqual(fhirAttachmentDataBase64Encoded, hvFileContentBase64Encoded);
        }
示例#18
0
        public void WhenHealthVaultCdaTransformedToFhir_ThenValuesEqual()
        {
            string cdaXmlRaw = SampleUtil.GetSampleContent("CDA.xml");

            XPathDocument xpDoc = DocumentReferenceHelper.GetXPathDocumentFromXml(cdaXmlRaw);

            Assert.IsNotNull(xpDoc);

            CDA cda = new CDA();

            cda.TypeSpecificData = xpDoc;

            var documentReference = cda.ToFhir() as DocumentReference;

            Assert.IsNotNull(documentReference);
            Assert.IsNotNull(documentReference.Type);
            Assert.AreEqual(documentReference.Content.Count, 1);
            Assert.IsNotNull(documentReference.Content[0].Attachment);
            Assert.IsNotNull(documentReference.Content[0].Attachment.Data);
            Assert.IsNotNull(documentReference.Content[0].Attachment.ContentType, "application/xml");

            string cdaXml = DocumentReferenceHelper.GetXmlFromXPathNavigator(cda.TypeSpecificData.CreateNavigator());
            string cdaContentBase64Encoded = Convert.ToBase64String(Encoding.UTF8.GetBytes(cdaXml));

            string fhirXmlRaw = Encoding.UTF8.GetString(documentReference.Content[0].Attachment.Data);

            XPathDocument fhirXPathDoc;

            using (TextReader txtReader = new StringReader(fhirXmlRaw))
            {
                fhirXPathDoc = new XPathDocument(txtReader);
            }

            string fhirXml = DocumentReferenceHelper.GetXmlFromXPathNavigator(xpDoc.CreateNavigator());
            string fhirAttachmentDataBase64Encoded = Convert.ToBase64String(documentReference.Content[0].Attachment.Data);

            Assert.AreEqual(fhirAttachmentDataBase64Encoded, cdaContentBase64Encoded);
        }
        public void WhenHealthVaultThingIsTransformedToFhirDocumentReference_ThenTypeAndStatusAndIndexedFieldsSet()
        {
            string        cdaXmlRaw = SampleUtil.GetSampleContent("CCR.xml");
            XPathDocument xpDoc     = DocumentReferenceHelper.GetXPathDocumentFromXml(cdaXmlRaw);

            CCR ccr = new CCR();

            ccr.TypeSpecificData = xpDoc;
            ccr.EffectiveDate    = new NodaTime.LocalDateTime(2016, 05, 09, 3, 36, 55);

            var documentReference = ccr.ToFhir() as DocumentReference;

            Assert.IsNotNull(documentReference);
            Assert.IsNotNull(documentReference.Type);
            Assert.IsNotNull(documentReference.Status);
            Assert.AreEqual(documentReference.Status, DocumentReferenceStatus.Current);
            Assert.IsNotNull(documentReference.Indexed);

            var indexed = documentReference.Indexed.Value;
            var indexedLocalDateTime = new NodaTime.LocalDateTime(indexed.Year, indexed.Month, indexed.Day, indexed.Hour, indexed.Minute, indexed.Second);

            Assert.AreEqual(indexedLocalDateTime, ccr.EffectiveDate.Value);
        }
示例#20
0
        public void WhenFhirImmunizationWithExtensionToHealthVaultImmunization_ThenExtendedValuesAreParsedAndAreEqual()
        {
            var json = SampleUtil.GetSampleContent("HealthVaultToFhirImmunization.json");

            var fhirParser       = new FhirJsonParser();
            var fhirImmunization = fhirParser.Parse <Immunization>(json);

            var hvImmunization = fhirImmunization.ToHealthVault();

            Assert.IsNotNull(hvImmunization);
            Assert.AreEqual("cholera vaccine", hvImmunization.Name.Text);
            Assert.IsNotNull(hvImmunization.DateAdministrated.ApproximateDate);
            Assert.AreEqual(2017, hvImmunization.DateAdministrated.ApproximateDate.Year);
            Assert.IsNotNull(hvImmunization.DateAdministrated.ApproximateDate.Month);
            Assert.AreEqual(9, hvImmunization.DateAdministrated.ApproximateDate.Month.Value);
            Assert.IsNotNull(hvImmunization.DateAdministrated.ApproximateDate.Day);
            Assert.AreEqual(21, hvImmunization.DateAdministrated.ApproximateDate.Day.Value);
            Assert.AreEqual("By mouth", hvImmunization.Route.Text);
            Assert.AreEqual("AAJN11K", hvImmunization.Lot);
            Assert.IsNotNull(hvImmunization.ExpirationDate);
            Assert.AreEqual(2017, hvImmunization.ExpirationDate.Year);
            Assert.IsNotNull(hvImmunization.ExpirationDate.Month);
            Assert.AreEqual(10, hvImmunization.ExpirationDate.Month.Value);
            Assert.IsNotNull(hvImmunization.ExpirationDate.Day);
            Assert.AreEqual(20, hvImmunization.ExpirationDate.Day.Value);
            Assert.AreEqual("Metacarpophalangeal joint structure of index finger", hvImmunization.AnatomicSurface.Text);

            Assert.IsNotNull(hvImmunization.Administrator);
            Assert.AreEqual("Justin Case", hvImmunization.Administrator.Name.Full);
            Assert.IsNotNull(hvImmunization.Manufacturer);
            Assert.AreEqual("Baxter Healthcare Corporation", hvImmunization.Manufacturer.Text);

            //Extensions
            Assert.AreEqual("Last", hvImmunization.Sequence);
            Assert.AreEqual("A concent from parent goes here", hvImmunization.Consent);
            Assert.AreEqual("Something bad happened", hvImmunization.AdverseEvent);
        }
        public void WhenFhirFullPatientTransformedToHealthVault_ThenValuesEqual()
        {
            var json       = SampleUtil.GetSampleContent("FhirPatientFull.json");
            var fhirParser = new FhirJsonParser();
            var patient    = fhirParser.Parse <Patient>(json);

            var things = patient.ToHealthVault();

            Assert.AreEqual(4, things.Count);

            foreach (var thingBase in things)
            {
                switch (thingBase)
                {
                case BasicV2 basic:
                    Assert.IsNotNull(basic);
                    Assert.AreEqual(1975, basic.BirthYear);
                    Assert.AreEqual(Gender.Female, basic.Gender);
                    Assert.AreEqual(DayOfWeek.Sunday, basic.FirstDayOfWeek);
                    Assert.AreEqual("Redmond", basic.City);
                    Assert.AreEqual("Washington", basic.StateOrProvince.Text);
                    Assert.AreEqual("98052", basic.PostalCode);
                    Assert.AreEqual("United States of America", basic.Country.Text);
                    Assert.AreEqual(2, basic.Languages.Count);
                    Assert.AreEqual("English", basic.Languages[0].SpokenLanguage.Text);
                    Assert.AreEqual(true, basic.Languages[0].IsPrimary);
                    Assert.AreEqual("French", basic.Languages[1].SpokenLanguage.Text);
                    break;

                case Contact contact:
                    Assert.IsNotNull(contact);

                    Assert.AreEqual(2, contact.ContactInformation.Address.Count);
                    var address1 = contact.ContactInformation.Address[0];
                    Assert.AreEqual("Home address", address1.Description);
                    Assert.AreEqual("123 Main St.", address1.Street[0]);
                    Assert.AreEqual("Apt. 3B", address1.Street[1]);
                    Assert.AreEqual("Redmond", address1.City);
                    Assert.AreEqual("WA", address1.State);
                    Assert.AreEqual("98052", address1.PostalCode);
                    Assert.AreEqual("USA", address1.Country);
                    Assert.AreEqual("King", address1.County);
                    Assert.AreEqual(true, address1.IsPrimary);

                    Assert.AreEqual(2, contact.ContactInformation.Email.Count);
                    var email1 = contact.ContactInformation.Email[0];
                    Assert.AreEqual("Address 1", email1.Description);
                    Assert.AreEqual("*****@*****.**", email1.Address);
                    Assert.AreEqual(true, email1.IsPrimary);

                    Assert.AreEqual(2, contact.ContactInformation.Phone.Count);
                    var phone1 = contact.ContactInformation.Phone[0];
                    Assert.AreEqual("Phone 1", phone1.Description);
                    Assert.AreEqual("1-425-555-0100", phone1.Number);
                    Assert.AreEqual(true, phone1.IsPrimary);
                    break;

                case PersonalImage personalImage:
                    Assert.IsNotNull(personalImage);

                    using (Stream currentImageStream = personalImage.ReadImage())
                    {
                        Assert.AreEqual(1757, currentImageStream.Length);
                    }
                    break;

                case Personal personal:
                    Assert.IsNotNull(personal);

                    Assert.AreEqual("Dr.", personal.Name.Title.Text);
                    Assert.AreEqual("John", personal.Name.First);
                    Assert.AreEqual("Phillip", personal.Name.Middle);
                    Assert.AreEqual("Doe", personal.Name.Last);
                    Assert.AreEqual("Junior", personal.Name.Suffix.Text);
                    Assert.AreEqual("Dr. John Phillip Doe, Jr.", personal.Name.Full);

                    Assert.AreEqual(new HealthServiceDateTime(new LocalDateTime(1975, 2, 5, 1, 30, 34, 015)), personal.BirthDate);
                    Assert.AreEqual(new ApproximateDateTime(new LocalDateTime(2075, 5, 7, 0, 0)), personal.DateOfDeath);
                    Assert.AreEqual("Employed", personal.EmploymentStatus);
                    Assert.AreEqual("Other Race", personal.Ethnicity.Text);
                    Assert.AreEqual("College Graduate", personal.HighestEducationLevel.Text);
                    Assert.AreEqual(false, personal.IsDisabled);
                    Assert.AreEqual(true, personal.IsVeteran);
                    Assert.AreEqual("Never Married", personal.MaritalStatus.Text);
                    Assert.AreEqual("Organ Donor", personal.OrganDonor);
                    Assert.AreEqual("Agnostic", personal.Religion.Text);
                    Assert.AreEqual("000-12-3456", personal.SocialSecurityNumber);
                    break;
                }
            }
        }