public void WhenNoEntriesInJournal()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();

            var resultJournal = testJournal.GetEntriesByYear(2017);

            Assert.AreEqual(0, resultJournal.Count);
        }
        public void WhenAdd1CountShouldBe1()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();
            var testEntry   = new FitbitEntry(DateTime.Today, 500, 2.0, 310, 1, 155, new TimeSpan());

            testJournal.AddEntry(testEntry);

            Assert.AreEqual(1, testJournal.Count);
        }
        public void WhenOnlyOneInJournalAndMatches()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();
            var testEntry   = new FitbitEntry(DateTime.Today, 500, 2.0, 310, 1, 155, new TimeSpan());

            testJournal.AddEntry(testEntry);

            Assert.AreEqual(1, testJournal.CountDaysWithStepsOver(200));
        }
        public void WhenOnlyOneInJournalAndMatches()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();
            var testEntry   = new FitbitEntry(DateTime.Today, 500, 2.0, 310, 1, 155, new TimeSpan());

            testJournal.AddEntry(testEntry);

            Assert.AreEqual(1, testJournal.CountPerMonthAndYear(DateTime.Today.Month, DateTime.Today.Year));
        }
        public void WhenContainsDate()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();
            var testDate    = new DateTime(2017, 11, 2);
            var testEntry1  = new FitbitEntry(testDate, 500, 2.0, 310, 1, 155, new TimeSpan());

            testJournal.AddEntry(testEntry1);

            Assert.AreEqual(true, testJournal.ContainsDate(testDate));
        }
        public void WhenEntryInJournalMatches()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();
            var testDate    = new DateTime(2017, 11, 2);
            var testEntry1  = new FitbitEntry(testDate, 500, 2.0, 310, 1, 155, new TimeSpan());

            testJournal.AddEntry(testEntry1);

            Assert.AreEqual(500, testJournal.GetEntryByDate(testDate).Steps);
        }
Ejemplo n.º 7
0
        public void WhenEntryInJournalMatches()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();
            var testDate    = new DateTime(2017, 11, 2);
            var testEntry1  = new FitbitEntry(testDate, 1234, 2.0, 310, 1, 155, new TimeSpan());

            testJournal.AddEntry(testEntry1);

            Assert.AreEqual(testDate, testJournal.FindDateBasedOnSteps(1234));
        }
Ejemplo n.º 8
0
        /// <summary>
        ///     Gets the entries by year.
        /// </summary>
        /// <param name="year">The year.</param>
        /// <returns>
        ///     a Journal containing the yearly entries for the year in the year parameter
        /// </returns>
        public FitbitJournal GetEntriesByYear(int year)
        {
            var entries       = this.Entries.FindAll(entry => entry.Date.Year == year);
            var yearlyJournal = new FitbitJournal();

            foreach (var entry in entries)
            {
                yearlyJournal.AddEntry(entry);
            }
            return(yearlyJournal);
        }
        public void WhenReplaceActivityCaloriesOfFirst()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();
            var testDate    = new DateTime(2017, 11, 2);
            var testEntry1  = new FitbitEntry(testDate, 500, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry2  = new FitbitEntry(testDate, 500, 75.0, 310, 1, 72, new TimeSpan());

            testJournal.AddEntry(testEntry1);
            testJournal.ReplaceMatchingDateEntries(testEntry2);

            Assert.AreEqual(72, testJournal.GetEntryByDate(testDate).ActivityCalories);
        }
        public void When1EntryInMultipleMatchesHasProperDate()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();
            var testDate1   = new DateTime(2017, 11, 2);
            var testDate2   = new DateTime(2016, 10, 20);
            var testEntry1  = new FitbitEntry(testDate1, 500, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry2  = new FitbitEntry(testDate2, 2000, 2.0, 310, 1, 155, new TimeSpan());

            testJournal.AddEntry(testEntry1);
            testJournal.AddEntry(testEntry2);

            Assert.AreEqual(testDate2, testJournal.GetEntryByDate(testDate2).Date);
        }
        public void WhenMultiplesInJournalAndNoneMatch()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();
            var testEntry   = new FitbitEntry(DateTime.Today, 1000, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry2  = new FitbitEntry(DateTime.Today, 2000, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry3  = new FitbitEntry(DateTime.Today, 3000, 2.0, 310, 1, 155, new TimeSpan());

            testJournal.AddEntry(testEntry);
            testJournal.AddEntry(testEntry2);
            testJournal.AddEntry(testEntry3);

            Assert.AreEqual(0, testJournal.CountDaysWithStepsOver(5000));
        }
        public void WhenAdd4CountIs4()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();
            var testEntry   = new FitbitEntry(DateTime.Today, 500, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry2  = new FitbitEntry(DateTime.Today, 1000, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry3  = new FitbitEntry(DateTime.Today, 1200, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry4  = new FitbitEntry(DateTime.Today, 800, 2.0, 310, 1, 155, new TimeSpan());

            testJournal.AddEntry(testEntry);
            testJournal.AddEntry(testEntry2);
            testJournal.AddEntry(testEntry3);
            testJournal.AddEntry(testEntry4);

            Assert.AreEqual(4, testJournal.Count);
        }
Ejemplo n.º 13
0
        public void WhenMultipleInJournalAndMultipleMatch()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();
            var testEntry   = new FitbitEntry(DateTime.Today, 500, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry2  = new FitbitEntry(DateTime.Today, 1000, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry3  = new FitbitEntry(DateTime.Today, 1200, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry4  = new FitbitEntry(DateTime.Today, 800, 2.0, 310, 1, 155, new TimeSpan());

            testJournal.AddEntry(testEntry);
            testJournal.AddEntry(testEntry2);
            testJournal.AddEntry(testEntry3);
            testJournal.AddEntry(testEntry4);

            Assert.AreEqual(2, testJournal.CountDaysWithStepsBetween(2, 900));
        }
        public void WhenContainsDateFromMultipleInJounral()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();
            var testDate1   = new DateTime(2017, 11, 2);
            var testDate2   = new DateTime(2016, 10, 20);
            var testDate3   = new DateTime(2016, 9, 4);
            var testEntry1  = new FitbitEntry(testDate1, 500, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry2  = new FitbitEntry(testDate2, 2000, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry3  = new FitbitEntry(testDate3, 900, 0.5, 400, 1, 155, new TimeSpan());

            testJournal.AddEntry(testEntry1);
            testJournal.AddEntry(testEntry2);
            testJournal.AddEntry(testEntry3);

            Assert.AreEqual(true, testJournal.ContainsDate(testDate2));
        }
Ejemplo n.º 15
0
        public void When1EntryInMultipleMatches()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();
            var testDate1   = new DateTime(2017, 11, 2);
            var testDate2   = new DateTime(2016, 10, 20);
            var testDate3   = new DateTime(2014, 6, 14);
            var testEntry1  = new FitbitEntry(testDate1, 500, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry2  = new FitbitEntry(testDate2, 2000, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry3  = new FitbitEntry(testDate3, 7300, 2.0, 310, 1, 155, new TimeSpan());

            testJournal.AddEntry(testEntry1);
            testJournal.AddEntry(testEntry2);
            testJournal.AddEntry(testEntry3);

            Assert.AreEqual(testDate2, testJournal.FindDateBasedOnSteps(2000));
        }
        public void WhenMultipleDifferentYearAndMonthInJournalAndOneMatch()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();
            var testDate1   = new DateTime(2015, 9, 2);
            var testDate2   = new DateTime(2016, 10, 5);
            var testDate3   = new DateTime(2017, 11, 3);

            var testEntry  = new FitbitEntry(testDate1, 1000, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry2 = new FitbitEntry(testDate2, 2000, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry3 = new FitbitEntry(testDate3, 3000, 2.0, 310, 1, 155, new TimeSpan());

            testJournal.AddEntry(testEntry);
            testJournal.AddEntry(testEntry2);
            testJournal.AddEntry(testEntry3);

            Assert.AreEqual(1, testJournal.CountPerMonthAndYear(10, 2016));
        }
        public void WhenAllEntriesMatchFromMultipleInJournal()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();
            var testDate1   = new DateTime(2016, 11, 2);
            var testDate2   = new DateTime(2016, 10, 20);
            var testDate3   = new DateTime(2016, 9, 4);
            var testEntry1  = new FitbitEntry(testDate1, 500, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry2  = new FitbitEntry(testDate2, 2000, 2.0, 310, 1, 155, new TimeSpan());
            var testEntry3  = new FitbitEntry(testDate3, 900, 0.5, 400, 1, 155, new TimeSpan());

            testJournal.AddEntry(testEntry1);
            testJournal.AddEntry(testEntry2);
            testJournal.AddEntry(testEntry3);

            var resultJournal = testJournal.GetEntriesByYear(2016);

            Assert.AreEqual(3, resultJournal.Count);
        }
        public void WhenAddNoneCountShouldBe0()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();

            Assert.AreEqual(0, testJournal.Count);
        }
        public void WhenNoEntriesInJournal()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();

            Assert.AreEqual(0, testJournal.CountDaysWithStepsOver(1000));
        }
        public void WhenNoEntriesInJournalShouldBe0()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();

            Assert.AreEqual(0, testJournal.CountPerMonthAndYear(11, 2017));
        }
        public void WhenAddingNullToJournal()
        {
            var testJournal = new FitbitAnalysis_Phillip_Morris.Model.FitbitJournal();

            testJournal.AddEntry(null);
        }