Esempio n. 1
0
 public void GetDistances_NullList()
 {
     var model = new ActivitySummary();
     
     var d = model.GetDistancesAsDictionary();
     Assert.IsNotNull(d);
     Assert.AreEqual(0, d.Count);
 }
Esempio n. 2
0
        public void GetDistances_InstantiatedList()
        {
            var model = new ActivitySummary();
            model.Distances = new List<ActivityDistance>();
            model.Distances.Add(new ActivityDistance { Distance = 12, Activity = "test#1" });
            model.Distances.Add(new ActivityDistance { Distance = 0.56F, Activity = "test#2" });

            var d = model.GetDistancesAsDictionary();
            Assert.IsNotNull(d);
            Assert.AreEqual(2, d.Count);

            Assert.IsTrue(d.ContainsKey("test#1"));
            var ad = d["test#1"];
            Assert.AreEqual(12, ad);

            Assert.IsTrue(d.ContainsKey("test#2"));
            ad = d["test#2"];
            Assert.AreEqual(0.56F, ad);
        }
Esempio n. 3
0
        private void ValidateActivitySummary(ActivitySummary summary)
        {
            // activity calories?
            // calories BMR?
            Assert.AreEqual(2828, summary.CaloriesOut);
            Assert.AreEqual(63, summary.FairlyActiveMinutes);
            Assert.AreEqual(59, summary.LightlyActiveMinutes);
            // marginal caloties?
            Assert.AreEqual(1155, summary.SedentaryMinutes);
            Assert.AreEqual(15720, summary.Steps);
            Assert.AreEqual(91, summary.VeryActiveMinutes);

            // distances
            var d = summary.Distances.First(x => x.Activity == "total");
            Assert.IsNotNull(d);
            Assert.AreEqual(12.32f, d.Distance);

            d = summary.Distances.First(x => x.Activity == "tracker");
            Assert.IsNotNull(d);
            Assert.AreEqual(12.32f, d.Distance);

            d = summary.Distances.First(x => x.Activity == "loggedActivities");
            Assert.IsNotNull(d);
            Assert.AreEqual(0, d.Distance);

            d = summary.Distances.First(x => x.Activity == "veryActive");
            Assert.IsNotNull(d);
            Assert.AreEqual(9.69f, d.Distance);

            d = summary.Distances.First(x => x.Activity == "moderatelyActive");
            Assert.IsNotNull(d);
            Assert.AreEqual(1.99f, d.Distance);

            d = summary.Distances.First(x => x.Activity == "lightlyActive");
            Assert.IsNotNull(d);
            Assert.AreEqual(0.57f, d.Distance);

            d = summary.Distances.First(x => x.Activity == "sedentaryActive");
            Assert.IsNotNull(d);
            Assert.AreEqual(0, d.Distance);

            d = summary.Distances.First(x => x.Activity == "Running (jogging), 6.7 mph (9 min mile) (MyFitnessPal)");
            Assert.IsNotNull(d);
            Assert.AreEqual(0, d.Distance);
        }