Beispiel #1
0
        public async Task SetGoalsAsync_AllSet()
        {
            FitbitClient fitbitClient = SetupFitbitClient("caloriesOut=2000&distance=8.5&floors=20&steps=10000&activeMinutes=50");

            ActivityGoals response = await fitbitClient.SetGoalsAsync(2000, 8.5M, 20, 10000, 50);

            Assert.IsNotNull(response);
        }
Beispiel #2
0
        public async Task SetGoalsAsync_ActiveMinuitesSet()
        {
            FitbitClient fitbitClient = SetupFitbitClient("activeMinutes=50");

            ActivityGoals response = await fitbitClient.SetGoalsAsync(activeMinutes : 50);

            Assert.IsNotNull(response);
        }
Beispiel #3
0
        public async Task SetGoalsAsync_StepsSet()
        {
            FitbitClient fitbitClient = SetupFitbitClient("steps=10000");

            ActivityGoals response = await fitbitClient.SetGoalsAsync(steps : 10000);

            Assert.IsNotNull(response);
        }
Beispiel #4
0
        public async Task SetGoalsAsync_FloorsSet()
        {
            FitbitClient fitbitClient = SetupFitbitClient("floors=20");

            ActivityGoals response = await fitbitClient.SetGoalsAsync(floors : 20);

            Assert.IsNotNull(response);
        }
Beispiel #5
0
        public async Task SetGoalsAsync_DistanceSet()
        {
            FitbitClient fitbitClient = SetupFitbitClient("distance=8.5");

            ActivityGoals response = await fitbitClient.SetGoalsAsync(distance : 8.5M);

            Assert.IsNotNull(response);
        }
Beispiel #6
0
        public async Task SetGoalsAsync_CaloriesOutSet()
        {
            FitbitClient fitbitClient = SetupFitbitClient("caloriesOut=2000");

            ActivityGoals response = await fitbitClient.SetGoalsAsync(caloriesOut : 2000);

            Assert.IsNotNull(response);
        }
Beispiel #7
0
        public async Task <ActionResult> ActivityGoals(ActivityGoals goals)
        {
            FitbitClient client = GetFitbitClient();

            var response = await client.SetGoalsAsync(goals.CaloriesOut, (decimal)goals.Distance, (goals.Floors.HasValue ? goals.Floors.Value : default(int)),
                                                      goals.Steps, (goals.ActiveMinutes.HasValue ? goals.ActiveMinutes.Value : default(int)), period : GoalPeriod.Daily);

            return(View(response));
        }
Beispiel #8
0
        public void Can_Deserialize_ActivityGoal_FromActivities()
        {
            string content      = SampleDataHelper.GetContent("GetActivities.json");
            var    deserializer = new JsonDotNetSerializer {
                RootProperty = "goals"
            };

            ActivityGoals goal = deserializer.Deserialize <ActivityGoals>(content);

            ValidateActivityGoals(goal);
        }
Beispiel #9
0
 private static void ValidateActivityGoals(ActivityGoals g)
 {
     Assert.AreEqual(10000, g.Steps);
     Assert.AreEqual(8.05, g.Distance);
     Assert.AreEqual(2820, g.CaloriesOut);
 }