private DataTable GeneratePcsReworkTable()
        {
            DataTable output = new DataTable();

            output.Columns.Add("Rework");
            AddDaysToColumns(output);
            foreach (var recipe in DailyResults.First().DailyRework.Select(x => x.RecipeName).ToList())
            {
                output.Rows.Add(GetRowDailyReworkForRecipe().ToArray <string>());
            }

            return(null);
        }
Пример #2
0
        public void searchDatabaseDateRangeTest()
        {
            DailyResults result1 = new DailyResults {
                date           = System.DateTime.Today.Date,
                calorieTarget  = 3000,
                sleepTarget    = 8,
                workoutTarget  = 60,
                caloriesLogged = 1000,
                sleepLogged    = 2,
                workoutLogged  = 20,
                notesLogged    = "had a good day",
            };

            DailyResults result2 = new DailyResults
            {
                date           = System.DateTime.Today.AddDays(-1).Date,
                calorieTarget  = 3000,
                sleepTarget    = 8,
                workoutTarget  = 60,
                caloriesLogged = 2000,
                sleepLogged    = 7,
                workoutLogged  = 40,
                notesLogged    = "had a good day",
            };

            DailyResults result3 = new DailyResults
            {
                date           = System.DateTime.Today.AddDays(-2).Date,
                calorieTarget  = 3000,
                sleepTarget    = 8,
                workoutTarget  = 60,
                caloriesLogged = 3000,
                sleepLogged    = 8,
                workoutLogged  = 60,
                notesLogged    = "had a good day",
            };

            App.Database.SaveTargetAsync(result1);
            App.Database.SaveTargetAsync(result2);
            App.Database.SaveTargetAsync(result3);

            var result = App.Database.GetDateRange(System.DateTime.Today.AddDays(-2).Date, System.DateTime.Today.Date).Result;

            System.Console.WriteLine("number of results from search: " + result.Count);

            Assert.NotNull(App.Database.GetDailyTargetsListAsync());
            Assert.NotNull(result);
        }
Пример #3
0
        public void calculateWeeklyTest()
        {
            Performance.Weekly weekly  = new Performance.Weekly(0, 0, 0);
            DailyResults       result1 = new DailyResults
            {
                date           = System.DateTime.Today.Date,
                calorieTarget  = 3000,
                sleepTarget    = 8,
                workoutTarget  = 60,
                caloriesLogged = 1000,
                sleepLogged    = 2,
                workoutLogged  = 20,
                notesLogged    = "had a good day",
            };

            DailyResults result3 = new DailyResults
            {
                date           = System.DateTime.Today.AddDays(-2).Date,
                calorieTarget  = 3000,
                sleepTarget    = 8,
                workoutTarget  = 60,
                caloriesLogged = 3000,
                sleepLogged    = 8,
                workoutLogged  = 60,
                notesLogged    = "had a good day",
            };

            DailyResults result2 = new DailyResults
            {
                date           = System.DateTime.Today.AddDays(-1).Date,
                calorieTarget  = 3000,
                sleepTarget    = 8,
                workoutTarget  = 60,
                caloriesLogged = 2000,
                sleepLogged    = 7,
                workoutLogged  = 40,
                notesLogged    = "had a good day",
            };

            App.Database.SaveTargetAsync(result1);
            App.Database.SaveTargetAsync(result3);
            App.Database.SaveTargetAsync(result2);

            weekly.CalculateWeekly();
            Assert.AreEqual(weekly.CalorieDeficit, -2000);
            Assert.AreEqual(weekly.WorkoutDeficit, -40);
            Assert.AreEqual(weekly.SleepDeficit, -6);
        }
Пример #4
0
        public void loadDatabaseTest()
        {
            User         testUser         = User.readFromJson();
            DailyTarget  testTarget       = testUser.getDailyTarget();
            DailyResults testDailyResults = new DailyResults {
                date           = testTarget.date.Date,
                calorieTarget  = testTarget.calorieTarget,
                sleepTarget    = testTarget.sleepTarget,
                workoutTarget  = testTarget.workoutTarget,
                caloriesLogged = testTarget.actualCalories,
                sleepLogged    = testTarget.actualSleep,
                workoutLogged  = testTarget.actualWorkout,
                notesLogged    = " ",
            };

            App.Database.SaveTargetAsync(testDailyResults);
            Assert.NotNull(App.Database.GetDailyTargetsListAsync());
        }