public async Task GetThingById()
        {
            IHealthVaultSodaConnection connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(Constants.Configuration);
            IThingClient thingClient = connection.CreateThingClient();
            PersonInfo   personInfo  = await connection.GetPersonInfoAsync();

            HealthRecordInfo record = personInfo.SelectedRecord;

            await DeletePreviousThings(thingClient, record);

            LocalDateTime nowLocal = SystemClock.Instance.GetCurrentInstant().InZone(DateTimeZoneProviders.Tzdb.GetSystemDefault()).LocalDateTime;

            var weight = new Weight(
                new HealthServiceDateTime(nowLocal),
                new WeightValue(81, new DisplayValue(81, "KG", "kg")));

            await thingClient.CreateNewThingsAsync(
                record.Id,
                new List <IThing>
            {
                weight
            });

            Weight remoteWeight = await thingClient.GetThingAsync <Weight>(record.Id, weight.Key.Id);

            Assert.IsNotNull(remoteWeight);
            Assert.AreEqual(weight.Key.Id, remoteWeight.Key.Id);
            Assert.AreEqual(weight.Value.Value, remoteWeight.Value.Value);
        }
Beispiel #2
0
        public async Task SimpleBloodPressure()
        {
            IHealthVaultSodaConnection connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(Constants.Configuration);
            IThingClient thingClient = connection.CreateThingClient();
            PersonInfo   personInfo  = await connection.GetPersonInfoAsync();

            await TestUtilities.RemoveAllThingsAsync <BloodPressure>(thingClient, personInfo.SelectedRecord.Id);

            // Create a new blood pressure object with random values
            Random        rand             = new Random();
            BloodPressure newBloodPressure = new BloodPressure
            {
                Diastolic = rand.Next(20, 100),
                Systolic  = rand.Next(80, 120)
            };

            // use our thing client to create the new blood pressure
            await thingClient.CreateNewThingsAsync(personInfo.SelectedRecord.Id, new List <BloodPressure> {
                newBloodPressure
            });

            // use our thing client to get all things of type blood pressure
            IReadOnlyCollection <BloodPressure> bloodPressures = await thingClient.GetThingsAsync <BloodPressure>(personInfo.SelectedRecord.Id);

            Assert.AreEqual(1, bloodPressures.Count);

            BloodPressure bp = bloodPressures.First();

            Assert.AreEqual(newBloodPressure.Systolic, bp.Systolic);
            Assert.AreEqual(newBloodPressure.Diastolic, bp.Diastolic);
        }
        public async Task CreateNewThingsReturnsIds()
        {
            IHealthVaultSodaConnection connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(Constants.Configuration);
            IThingClient thingClient = connection.CreateThingClient();
            PersonInfo   personInfo  = await connection.GetPersonInfoAsync();

            HealthRecordInfo record = personInfo.SelectedRecord;

            await DeletePreviousThings(thingClient, record);

            LocalDateTime nowLocal = SystemClock.Instance.GetCurrentInstant().InZone(DateTimeZoneProviders.Tzdb.GetSystemDefault()).LocalDateTime;

            var bloodGlucose = new BloodGlucose(
                new HealthServiceDateTime(nowLocal),
                new BloodGlucoseMeasurement(
                    4.2,
                    new DisplayValue(4.2, "mmol/L", "mmol-per-l")),
                new CodableValue("Whole blood", "wb", new VocabularyKey("glucose-measurement-type", "wc", "1")));

            var weight = new Weight(
                new HealthServiceDateTime(nowLocal),
                new WeightValue(81, new DisplayValue(81, "KG", "kg")));

            await thingClient.CreateNewThingsAsync(
                record.Id,
                new List <IThing>
            {
                bloodGlucose,
                weight,
            });

            Assert.IsNotNull(bloodGlucose.Key, "Blood glucose was not assigned a key.");
            Assert.IsNotNull(weight.Key, "Weight was not assigned a key.");
        }
        private async void ConnectToHealthVaultAsync(object sender, EventArgs eventArgs)
        {
            _statusView.Text = "Connecting...";

            // create a configuration for our HealthVault application
            var configuration = GetPpeConfiguration();

            try
            {
                // get a connection to HealthVault
                _connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(configuration);
                await _connection.AuthenticateAsync();
            }
            catch (Exception e)
            {
                _statusView.Text = $"Error connecting... {e.ToString()}";
            }

            // get a thing client

            _thingClient = _connection.CreateThingClient();

            PersonInfo personInfo = await _connection.GetPersonInfoAsync();

            // update visual state
            _connectionButton.Visibility = ViewStates.Gone;
            _controlsLayout.Visibility   = ViewStates.Visible;
            _disconnectButton.Visibility = ViewStates.Visible;
            _statusView.Text             = $"Hello {personInfo.Name}";
        }
Beispiel #5
0
        private async Task ConnectToHealthVaultAsync()
        {
            activityIndicator.StartAnimating();
            UpdateTitle("Connecting...");
            statusLabel.Text = "";

            try
            {
                var configuration = GetPpeConfiguration();

                _connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(configuration);
                await _connection.AuthenticateAsync();

                _thingClient = _connection.CreateThingClient();
                PersonInfo personInfo = await _connection.GetPersonInfoAsync();

                connectButton.SetTitle("Disconnect", UIControlState.Normal);
                SetStatusLabelText("");
                UpdateTitle(personInfo.Name);
                controlView.Hidden = false;
            }
            catch (Exception e)
            {
                UpdateTitle("Error");
                SetStatusLabelText(e.ToString());
                connectButton.SetTitle("Retry", UIControlState.Normal);
            }
        }
Beispiel #6
0
        public async Task SimpleMedications()
        {
            IHealthVaultSodaConnection connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(Constants.Configuration);
            IThingClient thingClient = connection.CreateThingClient();
            PersonInfo   personInfo  = await connection.GetPersonInfoAsync();

            HealthRecordInfo record = personInfo.SelectedRecord;

            await TestUtilities.RemoveAllThingsAsync <Medication>(thingClient, record.Id);

            var medication = new Medication
            {
                Name      = new CodableValue("My med"),
                Dose      = new GeneralMeasurement("2 tablets"),
                Strength  = new GeneralMeasurement("200mg"),
                Frequency = new GeneralMeasurement("Twice per day"),
                Route     = new CodableValue("By mouth", "po", new VocabularyKey("medication-routes", "wc", "2"))
            };

            await thingClient.CreateNewThingsAsync(record.Id, new IThing[] { medication });

            IReadOnlyCollection <Medication> medications = await thingClient.GetThingsAsync <Medication>(record.Id);

            Assert.AreEqual(1, medications.Count);

            Medication returnedMedication = medications.First();

            Assert.AreEqual(medication.Dose.Display, returnedMedication.Dose.Display);
            Assert.AreEqual(medication.Strength.Display, returnedMedication.Strength.Display);
            Assert.AreEqual(medication.Frequency.Display, returnedMedication.Frequency.Display);
            Assert.AreEqual(medication.Route.Text, returnedMedication.Route.Text);
        }
        public ActionPlanDetailsViewModel(ActionPlanInstanceV2 actionPlanInstance, IHealthVaultSodaConnection connection, INavigationService navigationService)
            : base(navigationService)
        {
            _connection         = connection;
            ItemSelectedCommand = new Command <ActionPlanTaskInstanceV2>(async o => await HandleTaskSelectedAsync(o));

            Plan = actionPlanInstance;
        }
        public ActionPlansViewModel(
            IHealthVaultSodaConnection connection,
            INavigationService navigationService)
            : base(navigationService)
        {
            _connection = connection;

            ItemSelectedCommand = new Command <ActionPlanInstanceV2>(async o => await GoToActionPlanDetailsPageAsync(o));
        }
        public void WhenGetCalledMultipleTimes_ThenSameInstanceIsReturned()
        {
            var config = CreateConfig();

            HealthVaultConnectionFactoryInternal healthVaultConnectionFactoryInternal = new HealthVaultConnectionFactoryInternal();
            IHealthVaultSodaConnection           connection = healthVaultConnectionFactoryInternal.GetOrCreateSodaConnection(config);

            IHealthVaultSodaConnection connection2 = healthVaultConnectionFactoryInternal.GetOrCreateSodaConnection(config);

            Assert.AreEqual(connection, connection2);
        }
Beispiel #10
0
        public async Task BasicRecordFields()
        {
            IHealthVaultSodaConnection connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(Constants.Configuration);
            PersonInfo personInfo = await connection.GetPersonInfoAsync();

            HealthRecordInfo record = personInfo.SelectedRecord;

            Assert.AreEqual("HealthVault SDK Integration Test", record.Name);
            Assert.AreEqual(new Guid("2d4e32e6-9511-42b3-8ac2-5f6524b305a2"), record.Id);
            Assert.AreEqual(RelationshipType.Self, record.RelationshipType);
        }
Beispiel #11
0
        private async void Connect_OnClick(object sender, RoutedEventArgs e)
        {
            OutputBlock.Text = "Connecting...";

            var configuration = new HealthVaultConfiguration
            {
                MasterApplicationId = Guid.Parse("d6318dff-5352-4a10-a140-6c82c6536a3b")
            };

            _connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(configuration);
            await _connection.AuthenticateAsync();

            OutputBlock.Text = "Connected.";
        }
        public void WhenCalledWithDifferentMasterAppId_ThenInvalidOperationExceptionThrown()
        {
            var config1 = CreateConfig();

            var config2 = new HealthVaultConfiguration
            {
                MasterApplicationId = new Guid("e2bab95d-cbb4-497e-ac2a-122d53a04b7a")
            };

            HealthVaultConnectionFactoryInternal healthVaultConnectionFactoryInternal = new HealthVaultConnectionFactoryInternal();
            IHealthVaultSodaConnection           connection = healthVaultConnectionFactoryInternal.GetOrCreateSodaConnection(config1);

            healthVaultConnectionFactoryInternal.GetOrCreateSodaConnection(config2);
        }
        public async Task MultipleQueries()
        {
            IHealthVaultSodaConnection connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(Constants.Configuration);
            IThingClient thingClient = connection.CreateThingClient();
            PersonInfo   personInfo  = await connection.GetPersonInfoAsync();

            HealthRecordInfo record = personInfo.SelectedRecord;

            await DeletePreviousThings(thingClient, record);

            LocalDateTime nowLocal = SystemClock.Instance.GetCurrentInstant().InZone(DateTimeZoneProviders.Tzdb.GetSystemDefault()).LocalDateTime;

            var bloodGlucose = new BloodGlucose(
                new HealthServiceDateTime(nowLocal),
                new BloodGlucoseMeasurement(
                    4.2,
                    new DisplayValue(4.2, "mmol/L", "mmol-per-l")),
                new CodableValue("Whole blood", "wb", new VocabularyKey("glucose-measurement-type", "wc", "1")));

            var weight = new Weight(
                new HealthServiceDateTime(nowLocal),
                new WeightValue(81, new DisplayValue(81, "KG", "kg")));

            await thingClient.CreateNewThingsAsync(
                record.Id,
                new List <IThing>
            {
                bloodGlucose,
                weight,
            });

            var resultSet = await thingClient.GetThingsAsync(record.Id, new[] { new ThingQuery(BloodGlucose.TypeId), new ThingQuery(Weight.TypeId) });

            Assert.AreEqual(2, resultSet.Count);
            var resultList = resultSet.ToList();

            ThingCollection glucoseCollection    = resultList[0];
            var             returnedBloodGlucose = (BloodGlucose)glucoseCollection.First();

            Assert.AreEqual(bloodGlucose.Value.Value, returnedBloodGlucose.Value.Value);

            ThingCollection weightCollection = resultList[1];
            var             returnedWeight   = (Weight)weightCollection.First();

            Assert.AreEqual(weight.Value.Kilograms, returnedWeight.Value.Kilograms);
        }
Beispiel #14
0
        private async void Connect_OnClicked(object sender, EventArgs e)
        {
            OutputLabel.Text = "Connecting...";

            var configuration = new HealthVaultConfiguration
            {
                MasterApplicationId = Guid.Parse("d6318dff-5352-4a10-a140-6c82c6536a3b")
            };

            _connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(configuration);

            await _connection.AuthenticateAsync();

            _thingClient = _connection.CreateThingClient();
            ConnectedButtons.IsVisible = true;

            OutputLabel.Text = "Connected.";
        }
Beispiel #15
0
        public async Task BasicInformationFields()
        {
            IHealthVaultSodaConnection connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(Constants.Configuration);
            PersonInfo personInfo = await connection.GetPersonInfoAsync();

            HealthRecordInfo record = personInfo.SelectedRecord;

            IThingClient thingClient = connection.CreateThingClient();

            BasicV2 basicInfo = (await thingClient.GetThingsAsync <BasicV2>(record.Id)).First();

            Assert.AreEqual("Redmond", basicInfo.City);
            Assert.AreEqual(1985, basicInfo.BirthYear);
            Assert.AreEqual(Gender.Male, basicInfo.Gender);
            Assert.AreEqual("98052", basicInfo.PostalCode);
            Assert.AreEqual("United States", basicInfo.Country.Text);
            Assert.AreEqual("Washington", basicInfo.StateOrProvince.Text);
        }
Beispiel #16
0
        public MenuViewModel(
            IHealthVaultSodaConnection connection,
            INavigationService navigationService)
            : base(navigationService)
        {
            _connection         = connection;
            ItemSelectedCommand = new Command <MenuItemViewRow>(async o => await GoToPageAsync(o));

            LoadState = LoadState.Loading;

            MenuViewRows.Add(new MenuItemViewRow
            {
                Title           = StringResource.ActionPlans,
                Description     = StringResource.ActionPlansDescription,
                Image           = ImageSource.FromResource("HealthVault.Sample.Xamarin.Core.Images.ap_icon.png"),
                BackgroundColor = Color.FromHex("#e88829"),
                PageAction      = async() => await OpenActionPlansPageAsync(),
            });
            MenuViewRows.Add(new MenuItemViewRow
            {
                Title           = StringResource.Medications,
                Description     = StringResource.MedicationsDescription,
                Image           = ImageSource.FromResource("HealthVault.Sample.Xamarin.Core.Images.meds_icon.png"),
                BackgroundColor = Color.FromHex("#86bbbf"),
                PageAction      = async() => await OpenMedicationsPageAsync(),
            });
            MenuViewRows.Add(new MenuItemViewRow
            {
                Title           = StringResource.Weight,
                Description     = StringResource.WeightDescription,
                Image           = ImageSource.FromResource("HealthVault.Sample.Xamarin.Core.Images.weight_icon.png"),
                BackgroundColor = Color.FromHex("#f8b942"),
                PageAction      = async() => await OpenWeightPageAsync(),
            });
            MenuViewRows.Add(new MenuItemViewRow
            {
                Title           = StringResource.Profile,
                Description     = StringResource.ProfileDescription,
                Image           = ImageSource.FromResource("HealthVault.Sample.Xamarin.Core.Images.profile_icon.png"),
                BackgroundColor = Color.FromHex("#00b294"),
                PageAction      = async() => await OpenPersonPageAsync(),
            });
        }
Beispiel #17
0
        public async Task SimpleWeights()
        {
            IHealthVaultSodaConnection connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(Constants.Configuration);
            IThingClient thingClient = connection.CreateThingClient();
            PersonInfo   personInfo  = await connection.GetPersonInfoAsync();

            HealthRecordInfo record = personInfo.SelectedRecord;

            await TestUtilities.RemoveAllThingsAsync <Weight>(thingClient, record.Id);

            LocalDateTime nowLocal = SystemClock.Instance.GetCurrentInstant().InZone(DateTimeZoneProviders.Tzdb.GetSystemDefault()).LocalDateTime;

            List <Weight> weightList = new List <Weight>();

            weightList.Add(new Weight(
                               new HealthServiceDateTime(nowLocal.PlusHours(-1)),
                               new WeightValue(81, new DisplayValue(81, "KG", "kg"))));

            weightList.Add(new Weight(
                               new HealthServiceDateTime(nowLocal),
                               new WeightValue(85, new DisplayValue(187, "LBS", "lb"))));

            await thingClient.CreateNewThingsAsync <Weight>(record.Id, weightList);

            IReadOnlyCollection <Weight> retrievedWeights = await thingClient.GetThingsAsync <Weight>(record.Id);

            Assert.AreEqual(2, retrievedWeights.Count);

            var    retrievedWeightsList = retrievedWeights.ToList();
            Weight firstWeight          = retrievedWeightsList[1];
            Weight secondWeight         = retrievedWeightsList[0];

            Assert.AreEqual(81, firstWeight.Value.Kilograms);
            Assert.AreEqual(81, firstWeight.Value.DisplayValue.Value);
            Assert.AreEqual("KG", firstWeight.Value.DisplayValue.Units);
            Assert.AreEqual("kg", firstWeight.Value.DisplayValue.UnitsCode);

            Assert.AreEqual(85, secondWeight.Value.Kilograms);
            Assert.AreEqual(187, secondWeight.Value.DisplayValue.Value);
            Assert.AreEqual("LBS", secondWeight.Value.DisplayValue.Units);
            Assert.AreEqual("lb", secondWeight.Value.DisplayValue.UnitsCode);
        }
Beispiel #18
0
        private async void Connect_OnClick(object sender, RoutedEventArgs e)
        {
            OutputBlock.Text = "Connecting...";

            var configuration = new HealthVaultConfiguration
            {
                MasterApplicationId = Guid.Parse(AppId)
            };

            _connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(configuration);

            HealthVaultConnectionFactory.ThingTypeRegistrar.RegisterApplicationSpecificHandler(
                applicationId: AppId,
                subtypeTag: CustomDataTypeSubtypeTag,
                applicationSpecificHandlerClass: typeof(CustomDataType));

            await _connection.AuthenticateAsync();

            OutputBlock.Text = "Connected.";
        }
Beispiel #19
0
        public async Task UsingDatesInThingsQueryReturnProperly()
        {
            IHealthVaultSodaConnection connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(Constants.Configuration);
            IThingClient thingClient = connection.CreateThingClient();
            PersonInfo   personInfo  = await connection.GetPersonInfoAsync();

            HealthRecordInfo record = personInfo.SelectedRecord;

            ThingQuery query = new ThingQuery(BloodGlucose.TypeId);
            var        now   = DateTime.UtcNow;

            query.CreatedDateMin    = Instant.FromDateTimeUtc(now.AddDays(-5));
            query.CreatedDateMax    = Instant.FromDateTimeUtc(now.AddDays(-4));
            query.UpdatedDateMin    = Instant.FromDateTimeUtc(now.AddDays(-3));
            query.UpdatedDateMax    = Instant.FromDateTimeUtc(now.AddDays(-2));
            query.UpdatedEndDateMin = LocalDateTime.FromDateTime(now.AddDays(-1));
            query.UpdatedEndDateMax = LocalDateTime.FromDateTime(now);

            var results = await thingClient.GetThingsAsync(record.Id, query);

            Assert.IsNotNull(results);
            Assert.IsNotNull(results.Query);
            Assert.IsNotNull(results.Query.CreatedDateMin);
            Assert.AreEqual(results.Query.CreatedDateMin.Value.ToDateTimeUtc(), now.AddDays(-5));

            Assert.IsNotNull(results.Query.CreatedDateMax);
            Assert.AreEqual(results.Query.CreatedDateMax.Value.ToDateTimeUtc(), now.AddDays(-4));

            Assert.IsNotNull(results.Query.UpdatedDateMin);
            Assert.AreEqual(results.Query.UpdatedDateMin.Value.ToDateTimeUtc(), now.AddDays(-3));

            Assert.IsNotNull(results.Query.UpdatedDateMax);
            Assert.AreEqual(results.Query.UpdatedDateMax.Value.ToDateTimeUtc(), now.AddDays(-2));

            Assert.IsNotNull(results.Query.UpdatedEndDateMin);
            Assert.AreEqual(results.Query.UpdatedEndDateMin.Value, LocalDateTime.FromDateTime(now.AddDays(-1)));

            Assert.IsNotNull(results.Query.UpdatedEndDateMax);
            Assert.AreEqual(results.Query.UpdatedEndDateMax.Value, LocalDateTime.FromDateTime(now));
        }
Beispiel #20
0
        public async Task SimpleActionPlans()
        {
            IHealthVaultSodaConnection connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(Constants.Configuration);
            PersonInfo personInfo = await connection.GetPersonInfoAsync();

            HealthRecordInfo record = personInfo.SelectedRecord;

            var restClient = connection.CreateMicrosoftHealthVaultRestApi(record.Id);

            await RemoveAllActionPlansAsync(restClient);

            Guid objectiveId = Guid.NewGuid();
            await restClient.ActionPlans.CreateAsync(CreateWeightActionPlan(objectiveId));

            ActionPlansResponseActionPlanInstance plans = await restClient.ActionPlans.GetAsync();

            Assert.AreEqual(1, plans.Plans.Count);

            ActionPlanInstance planInstance = plans.Plans[0];

            Assert.AreEqual(objectiveId, planInstance.Objectives[0].Id);
            Assert.AreEqual(ObjectiveName, planInstance.Objectives[0].Name);
            Assert.AreEqual(PlanName, planInstance.Name);
        }
Beispiel #21
0
        private async Task DisconnectFromHealthVaultAsync()
        {
            controlView.Hidden = true;
            activityIndicator.StartAnimating();
            UpdateTitle("Disconnecting...");

            try
            {
                await _connection.DeauthorizeApplicationAsync();

                _thingClient = null;
                _connection  = null;

                connectButton.SetTitle("Connect", UIControlState.Normal);
                UpdateTitle("Not Connected");
                SetStatusLabelText(notConnectedMessage);
            }
            catch (Exception e)
            {
                UpdateTitle("Error");
                SetStatusLabelText(e.ToString());
                connectButton.SetTitle("Retry", UIControlState.Normal);
            }
        }
        public ThingListViewController(IHealthVaultSodaConnection connection)

            : base("ThingListViewController", null)
        {
            _connection = connection;
        }
        public async Task MultipleThingTypes()
        {
            IHealthVaultSodaConnection connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(Constants.Configuration);
            IThingClient thingClient = connection.CreateThingClient();
            PersonInfo   personInfo  = await connection.GetPersonInfoAsync();

            HealthRecordInfo record = personInfo.SelectedRecord;

            await DeletePreviousThings(thingClient, record);

            LocalDateTime nowLocal = SystemClock.Instance.GetCurrentInstant().InZone(DateTimeZoneProviders.Tzdb.GetSystemDefault()).LocalDateTime;

            var bloodGlucose = new BloodGlucose(
                new HealthServiceDateTime(nowLocal),
                new BloodGlucoseMeasurement(
                    4.2,
                    new DisplayValue(4.2, "mmol/L", "mmol-per-l")),
                new CodableValue("Whole blood", "wb", new VocabularyKey("glucose-measurement-type", "wc", "1")));

            var weight = new Weight(
                new HealthServiceDateTime(nowLocal),
                new WeightValue(81, new DisplayValue(81, "KG", "kg")));

            var bloodPressure1 = new BloodPressure
            {
                EffectiveDate = nowLocal,
                Systolic      = 110,
                Diastolic     = 90,
            };

            var bloodPressure2 = new BloodPressure
            {
                EffectiveDate = nowLocal.PlusHours(-1),
                Systolic      = 111,
                Diastolic     = 91,
            };

            var cholesterolProfile = new CholesterolProfileV2
            {
                When         = new HealthServiceDateTime(nowLocal),
                LDL          = new ConcentrationMeasurement(110),
                HDL          = new ConcentrationMeasurement(65),
                Triglyceride = new ConcentrationMeasurement(140)
            };

            var labTestResult = new LabTestResults(new LabTestResultGroup[] { new LabTestResultGroup(new CodableValue("test")) });

            var immunization = new Immunization(new CodableValue("diphtheria, tetanus toxoids and acellular pertussis vaccine", "DTaP", new VocabularyKey("immunizations", "wc", "1")));

            var procedure = new Procedure(new CodableValue("A surgery"));

            var allergy = new Allergy(new CodableValue("Pollen"));

            var condition = new Condition(new CodableValue("Diseased"));

            await thingClient.CreateNewThingsAsync(
                record.Id,
                new List <IThing>
            {
                bloodGlucose,
                weight,
                bloodPressure1,
                bloodPressure2,
                cholesterolProfile,
                labTestResult,
                immunization,
                procedure,
                allergy,
                condition
            });

            var             query           = CreateMultiThingQuery();
            ThingCollection thingCollection = await thingClient.GetThingsAsync(record.Id, query);

            Assert.AreEqual(10, thingCollection.Count);

            var returnedBloodGlucose = (BloodGlucose)thingCollection.First(t => t.TypeId == BloodGlucose.TypeId);

            Assert.AreEqual(bloodGlucose.Value.Value, returnedBloodGlucose.Value.Value);

            var returnedWeight = (Weight)thingCollection.First(t => t.TypeId == Weight.TypeId);

            Assert.AreEqual(weight.Value.Kilograms, returnedWeight.Value.Kilograms);

            var returnedBloodPressures = thingCollection.Where(t => t.TypeId == BloodPressure.TypeId).Cast <BloodPressure>().ToList();

            Assert.AreEqual(2, returnedBloodPressures.Count);

            Assert.AreEqual(bloodPressure1.Systolic, returnedBloodPressures[0].Systolic);
        }
 public BloodPressureEntryViewController(IHealthVaultSodaConnection connection)
     : base("BloodPressureEntryViewController", null)
 {
     _connection = connection;
 }