Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            TrainingManager m = new TrainingManager(new UnitOfWork(new TrainingContext("Production")));

            m.AddCyclingTraining(new DateTime(2020, 4, 21, 16, 00, 00), 40, new TimeSpan(1, 20, 00), 30, null, TrainingType.Endurance, null, BikeType.RacingBike);
            m.AddCyclingTraining(new DateTime(2020, 4, 18, 18, 00, 00), 40, new TimeSpan(1, 42, 00), null, null, TrainingType.Recuperation, null, BikeType.RacingBike);
            m.AddCyclingTraining(new DateTime(2020, 4, 19, 16, 45, 00), null, new TimeSpan(1, 0, 00), null, 219, TrainingType.Interval, "5x5 min 270", BikeType.IndoorBike);
            m.AddRunningTraining(new DateTime(2020, 4, 17, 12, 30, 00), 5000, new TimeSpan(0, 27, 17), null, TrainingType.Endurance, null);
            m.AddRunningTraining(new DateTime(2020, 4, 19, 12, 30, 00), 5000, new TimeSpan(0, 25, 48), null, TrainingType.Endurance, null);
            m.AddRunningTraining(new DateTime(2020, 3, 17, 12, 0, 00), 5000, new TimeSpan(0, 28, 10), null, TrainingType.Interval, "3x700m");
            m.AddRunningTraining(new DateTime(2020, 3, 17, 11, 0, 00), 8000, new TimeSpan(0, 42, 10), null, TrainingType.Endurance, null);


            Report r1 = m.GenerateMonthlyCyclingReport(2020, 4);
            Report r2 = m.GenerateMonthlyRunningReport(2020, 4);

            Console.WriteLine("---------------------------");
            Report r3 = m.GenerateMonthlyTrainingsReport(2020, 4);

            foreach (var s in  r3.TimeLine)
            {
                Console.WriteLine($"{s.Item1.ToString()},{s.Item2}");
            }
        }
Ejemplo n.º 2
0
        public void ShowResults(int year, int month)
        {
            TrainingManager trainingManager = new TrainingManager(new UnitOfWork(new TrainingContext(_databaseString)));
            Report          report          = trainingManager.GenerateMonthlyCyclingReport(year, month);

            dataGridShowResults.ItemsSource = report.TimeLine;
            dataGridShowFastest.ItemsSource = new List <object>()
            {
                report.MaxSpeedSessionCycling
            };
            dataGridShowLongest.ItemsSource = new List <object>()
            {
                report.MaxDistanceSessionCycling
            };
            dataGridShowWattest.ItemsSource = new List <CyclingSession>()
            {
                report.MaxWattSessionCycling
            };
            startDateReport.Text = $"{report.StartDate.Year}/{report.StartDate.Month:00}/{report.StartDate.Day:00}";
            endDateReport.Text   = $"{report.EndDate.Year}/{report.EndDate.Month:00}/{report.EndDate.Day:00}";

            AmountOfCyclingSessions.Text = report.CyclingSessions.ToString();
            TotalCyclingTime.Text        = report.TotalCyclingTrainingTime.ToString();

            TotalCyclingDistance.Text = report.TotalCyclingDistance.ToString() + " km";
        }
Ejemplo n.º 3
0
        public void GenerateMonthlyCyclingReportTest()
        {
            SetupForReportTests();

            var r = tm.GenerateMonthlyCyclingReport(2020, 4);

            r.Rides.Select(x => x.When.Month).All(m => m == 4);
            r.Rides.Count.Should().Be(2);
            r.TotalCyclingDistance.Should().Be(40 + 40);
            r.TotalCyclingTrainingTime.Should().Be(TimeSpan.FromTicks(new TimeSpan(1, 20, 00).Ticks + new TimeSpan(1, 42, 00).Ticks));
        }
Ejemplo n.º 4
0
        private void DialogGenerateClickEevent(object sender, RoutedEventArgs e)
        {
            DateTime inputDate = new DateTime();

            try
            {
                inputDate = InputDate.SelectedDate.Value;
            }
            catch (Exception)
            {
                MessageBox.Show("You must fill in the date");
                return;
            }

            if (inputDate > DateTime.Now)
            {
                MessageBox.Show("You can't select a date in the future");
                return;
            }

            TrainingManager manager = new TrainingManager(new UnitOfWork(new TrainingContext("Production")));
            Report          rapport = manager.GenerateMonthlyCyclingReport(inputDate.Year, inputDate.Month);

            if (rapport.TotalCyclingTrainingTime.ToString(@"h\h") != "0h")
            {
                CountTime.Text = rapport.TotalCyclingTrainingTime.ToString(@"h\h") + " " + rapport.TotalCyclingTrainingTime.ToString(@"m\m");
            }
            else
            {
                CountTime.Text = rapport.TotalCyclingTrainingTime.ToString(@"m\m");
            }

            CountRunning.Text  = rapport.CyclingSessions.ToString();
            CountDistance.Text = rapport.TotalCyclingDistance + "km";

            dataTable.Clear();
            CyclingSession maxDistance = rapport.MaxDistanceSessionCycling;

            addDataLine("Distance", maxDistance.TrainingType.ToString(), maxDistance.Distance + " km", maxDistance.Time, Math.Round(Convert.ToDecimal(maxDistance.AverageSpeed), 2) + " km/h", (int)maxDistance.AverageWatt, maxDistance.BikeType.ToString(), maxDistance.When, maxDistance.Comments);

            CyclingSession maxSpeed = rapport.MaxSpeedSessionCycling;

            addDataLine("Speed", maxSpeed.TrainingType.ToString(), maxSpeed.Distance + " km", maxSpeed.Time, Math.Round(Convert.ToDecimal(maxSpeed.AverageSpeed), 2) + " km/h", (int)maxSpeed.AverageWatt, maxSpeed.BikeType.ToString(), maxSpeed.When, maxSpeed.Comments);

            CyclingSession maxWatt = rapport.MaxWattSessionCycling;

            addDataLine("Watt", maxWatt.TrainingType.ToString(), maxWatt.Distance + " km", maxWatt.Time, Math.Round(Convert.ToDecimal(maxWatt.AverageSpeed), 2) + " km/h", (int)maxWatt.AverageWatt, maxWatt.BikeType.ToString(), maxWatt.When, maxWatt.Comments);

            Dialog.IsOpen = false;
        }
Ejemplo n.º 5
0
        public void MonthlyCyclingTrainingTest()
        {
            // t.AddCyclingTraining(new DateTime(2020, 5, 24, 08, 00, 00), 60, new TimeSpan(1, 00, 02), 20, null, TrainingType.Endurance, "comment", BikeType.RacingBike);
            TrainingManager m = new TrainingManager(new UnitOfWork(new TrainingContext("Production")));

            m.AddCyclingTraining(new DateTime(2020, 4, 21, 16, 00, 00), 50, new TimeSpan(1, 20, 00), 30, null, TrainingType.Endurance, null, BikeType.RacingBike);
            m.AddCyclingTraining(new DateTime(2020, 4, 18, 18, 00, 00), 40, new TimeSpan(1, 42, 00), 20, null, TrainingType.Recuperation, null, BikeType.RacingBike);
            var mt = m.GenerateMonthlyCyclingReport(2020, 4);

            mt.TotalCyclingDistance.Should().Be(90);
            mt.TotalCyclingTrainingTime.Should().Be(new TimeSpan(3, 02, 00));
            mt.Rides.Select(x => x.When.Month).All(m => m == 4);
            mt.Rides.Count.Should().Be(2);
        }
Ejemplo n.º 6
0
        public void CycleReportTests()
        {
            TrainingManager tm = new TrainingManager(new UnitOfWork(new TrainingContextTest(false)));

            tm.AddCyclingTraining(new DateTime(2019, 10, 1), 200, new TimeSpan(2, 30, 0), 20, 2, TrainingType.Endurance, "number 1", BikeType.IndoorBike);
            tm.AddCyclingTraining(new DateTime(2019, 10, 2), 300, new TimeSpan(2, 30, 0), 20, 2, TrainingType.Endurance, "number 2", BikeType.IndoorBike);
            tm.AddCyclingTraining(new DateTime(2019, 10, 3), 150, new TimeSpan(2, 0, 0), 20, 2, TrainingType.Endurance, "number 3", BikeType.IndoorBike);
            tm.AddCyclingTraining(new DateTime(2018, 10, 1), 200, new TimeSpan(2, 30, 0), 20, 2, TrainingType.Endurance, "number 4", BikeType.IndoorBike);

            int   expectedNumberOfTrainings = 3;
            float expectedDistance          = 200;

            Report report = tm.GenerateMonthlyCyclingReport(2019, 10);

            report.CyclingSessions.Should().Be(expectedNumberOfTrainings);

            report.Rides[0].Distance.Should().Be(expectedDistance);
        }
Ejemplo n.º 7
0
        private void SetMonthlyOverview()
        {
            var  yearMonthArray = tbNumberOfMonthAndYear.Text.Split("/").ToList();
            bool monthOk        = int.TryParse(yearMonthArray.FirstOrDefault(), out int month);
            bool yearOk         = int.TryParse(yearMonthArray.LastOrDefault(), out int year);

            monthOk = (monthOk) ? (month > 0 && month < 13) : false;
            yearOk  = (yearOk) ? (year > 0 && year < 100000) : false;
            if (!monthOk || !yearOk)
            {
                MessageBox.Show("Give a acceptable date please...", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); tbNumberOfMonthAndYear.Text = String.Empty; return;
            }


            if (cbBycicle.IsChecked == true && cbRunning.IsChecked == false)
            {
                var report = tm.GenerateMonthlyCyclingReport(year, month);
                lvOverview.ItemsSource = report.Rides;
            }
            else if (cbRunning.IsChecked == true && cbBycicle.IsChecked == false)
            {
                var report = tm.GenerateMonthlyRunningReport(year, month);
                lvOverview.ItemsSource = report.Runs;
            }
            else if (cbRunning.IsChecked == true && cbBycicle.IsChecked == true)
            {
                var report   = tm.GenerateMonthlyTrainingsReport(year, month);
                var timeLine = report.TimeLine;
                var objects  = new List <Object>();
                foreach (var t in timeLine)
                {
                    objects.Add(t.Item2);
                }
                lvOverview.ItemsSource = objects;
            }
            else
            {
                MessageBox.Show("Please select Running or Biking or both...", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            lbTitle.Content = $"Sessions in {(Months)month} of {year}";
        }
Ejemplo n.º 8
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            TrainingManager m = new TrainingManager(new UnitOfWork(new TrainingContext("Production")));

            if (MonthRadioButton.IsChecked == true)
            {
                if (RunningRadioButton.IsChecked == true)
                {
                    Report report = m.GenerateMonthlyRunningReport(2020, (cmbMonth.SelectedIndex) + 1);
                    dgTraining.ItemsSource      = report.Runs;
                    txtBestDistance.Text        = report.MaxDistanceSessionRunning.ToString();
                    txtHighestAverageSpeed.Text = report.MaxSpeedSessionRunning.ToString();
                }
                else if (CyclingRadioButton.IsChecked == true)
                {
                    Report report = m.GenerateMonthlyCyclingReport(2020, (cmbMonth.SelectedIndex) + 1);
                    dgTraining.ItemsSource      = report.Rides;
                    txtBestDistance.Text        = report.MaxDistanceSessionCycling.ToString();
                    txtHighestAverageSpeed.Text = report.MaxSpeedSessionCycling.ToString();
                    txtHighestWattage.Text      = report.MaxWattSessionCycling.ToString();
                }

                else
                {
                    dgTraining.ItemsSource = m.GenerateMonthlyTrainingsReport(2020, (cmbMonth.SelectedIndex) + 1).TimeLine;
                }
            }
            else
            {
                if (RunningRadioButton.IsChecked == true)
                {
                    dgTraining.ItemsSource = m.GetPreviousRunningSessions(int.Parse(txtSessionAmount.Text));
                }
                else if (CyclingRadioButton.IsChecked == true)
                {
                    dgTraining.ItemsSource = m.GetPreviousCyclingSessions(int.Parse(txtSessionAmount.Text));
                }
            }
        }
        public void GenerateMonthlyCyclingReportTest()
        {
            //Arrange = initialisatie objecten en kent waarden van gegevens toe aan methoden
            int year  = 1996;
            int month = 1;
            //DB testCyclingSessions
            TrainingManager t = new TrainingManager(new UnitOfWork(new TrainingContextTest(false)));

            //Cyclingreport
            #region AddCyclingTraining maxDistanceSession
            DateTime now = new DateTime(1996, 1, 23); float distance = 257.20f; TimeSpan time = new TimeSpan(12, 05, 10);
            float    averageSpeed = 30.00f; int averageWatt = 200; TrainingType tt = TrainingType.Endurance; string comment = "Good job"; BikeType bt = BikeType.RacingBike;
            t.AddCyclingTraining(now, distance, time, averageSpeed, averageWatt, tt, comment, bt);
            #endregion
            #region AddCyclingTraining2 maxSpeedSession
            DateTime tommorow = new DateTime(1996, 1, 24); float distance2 = 120.40f; TimeSpan time2 = new TimeSpan(6, 03, 08);
            float    averageSpeed2 = 50.00f; int averageWatt2 = 200; TrainingType tt2 = TrainingType.Endurance; BikeType bt2 = BikeType.MountainBike;
            t.AddCyclingTraining(tommorow, distance2, time2, averageSpeed2, averageWatt2, tt2, comment, bt2);
            #endregion
            #region AddCyclingTraining3 maxWattSession
            DateTime afterTommorow = new DateTime(1996, 1, 25); float distance3 = 110.40f; TimeSpan time3 = new TimeSpan(6, 03, 08);
            float    averageSpeed3 = 30.00f; int averageWatt3 = 400; TrainingType tt3 = TrainingType.Endurance; BikeType bt3 = BikeType.MountainBike;
            t.AddCyclingTraining(afterTommorow, distance3, time3, averageSpeed3, averageWatt3, tt3, comment, bt3);
            #endregion
            //Act = roept testen method op met ingestgelde parameters
            Report rapport = t.GenerateMonthlyCyclingReport(year, month);
            //Assert = verifieert actie van geteste methoden
            //Test findMAxSessions
            rapport.MaxDistanceSessionCycling.Distance.Should().Be(257.20f);
            rapport.MaxSpeedSessionCycling.AverageSpeed.Should().Be(50.00f);
            rapport.MaxWattSessionCycling.AverageWatt.Should().Be(400);
            //Test TotalSessions
            rapport.CyclingSessions.Should().Be(3);
            rapport.TotalCyclingDistance.Should().Be(488.00f);
            rapport.TotalCyclingTrainingTime.Should().Be(new TimeSpan(24, 11, 26));
            //Test Timeline
            rapport.TimeLine.Should().NotBeEmpty();
        }
Ejemplo n.º 10
0
        private void inputButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int year = 0;
                if (string.IsNullOrWhiteSpace(yearInput.Text))
                {
                    throw new ArgumentException("Year is not a whole number.");
                }
                if (!int.TryParse(yearInput.Text, out int yearParsed))
                {
                    throw new ArgumentException("Year is not a whole number.");
                }
                else
                {
                    year = yearParsed;
                }
                int month = 0;
                if (string.IsNullOrWhiteSpace(monthInput.Text))
                {
                    throw new ArgumentException("Month is not a whole number.");
                }
                if (!int.TryParse(monthInput.Text, out int monthParsed))
                {
                    throw new ArgumentException("Month is not a whole number.");
                }
                else
                {
                    if (!(monthParsed <= 12))
                    {
                        throw new ArgumentException("Month is bigger than 12.");
                    }
                    month = monthParsed;
                }
                Report r = null;
                if (selectedBoxes == -1)
                {
                    r = tm.GenerateMonthlyTrainingsReport(year, month);
                    if (r.Runs.Count == 0)
                    {
                        throw new Exception("There are no run session for the given month and year.");
                    }
                    if (r.Rides.Count == 0)
                    {
                        throw new Exception("There are no cycle session for the given month and year.");
                    }
                }
                else if (selectedBoxes == 0)
                {
                    r = tm.GenerateMonthlyRunningReport(year, month);
                    if (r.Runs.Count == 0)
                    {
                        throw new Exception("There are no run session for the given month and year.");
                    }
                }
                else if (selectedBoxes == 1)
                {
                    r = tm.GenerateMonthlyCyclingReport(year, month);
                    if (r.Rides.Count == 0)
                    {
                        throw new Exception("There are no cycle session for the given month and year.");
                    }
                }

                sessionsHeader.Text  += $@" {month}/{year}";
                inputPanel.Visibility = Visibility.Collapsed;
                MaxHeight             = 450;
                MaxWidth    = 550;
                this.Height = 450;
                this.Width  = 600;
                if (selectedBoxes == -1 || selectedBoxes == 0)
                {
                    bestRunningSessions.Visibility = Visibility.Visible;
                }
                if (selectedBoxes == -1 || selectedBoxes == 1)
                {
                    bestCyclingSessions.Visibility = Visibility.Visible;
                }
                sessionsPanel.Visibility = Visibility.Visible;
                MinHeight = 450;
                MinWidth  = 600;

                SetSessions(r);
            }
            catch (ArgumentException aex)
            {
                ShowErrorMessage(aex.Message);
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex.Message);
            }
        }
Ejemplo n.º 11
0
 public Report GetMonlyCyclingReport(int jaar, int maant)
 {
     return(_gerry.GenerateMonthlyCyclingReport(jaar, maant));
 }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            bool?  cycling = cyclingCheckBox.IsChecked;
            bool?  running = runningCheckBox.IsChecked;
            int    year;
            int    month;
            bool   yearW  = int.TryParse(yearTextBox.Text, out year);
            bool   monthW = int.TryParse(monthTextBox.Text, out month);
            Report rapport;

            try
            {
                if (!yearW)
                {
                    throw new ArgumentException("year is not correct or not inserted");
                }
                else if (!monthW)
                {
                    throw new ArgumentException("Month is not correct or not inserted");
                }
                if (cycling == true && running == true)
                {
                    rapport = m.GenerateMonthlyTrainingsReport(year, month);
                    trainingPerMonthDataGrid.ItemsSource = rapport.TimeLine;
                    trainingPerMonthDataGrid.Items.Refresh();
                    //beste toevoegen
                    besteTrainingen.Text = "CyclingSSession \n" +
                                           "----------------\n" +
                                           $"MaxDistance: {rapport.MaxDistanceSessionCycling} \n" +
                                           $"MaxSpeed: {rapport.MaxSpeedSessionCycling}\n" +
                                           $"MaxWatt: {rapport.MaxWattSessionCycling}\n\n" +
                                           "RunningSession \n" +
                                           "----------------\n" +
                                           $"MaxDistance: {rapport.MaxDistanceSessionRunning}\n" +
                                           $"MaxSpeed: {rapport.MaxSpeedSessionRunning}\n";
                }
                else if (cycling == true)
                {
                    rapport = m.GenerateMonthlyCyclingReport(year, month);
                    trainingPerMonthDataGrid.ItemsSource = rapport.Rides;
                    trainingPerMonthDataGrid.Items.Refresh();
                    //beste toevoegen
                    besteTrainingen.Text = "CyclingSSession \n" +
                                           "----------------\n" +
                                           $"MaxDistance: {rapport.MaxDistanceSessionCycling}\n" +
                                           $"MaxSpeed: {rapport.MaxSpeedSessionCycling}\n" +
                                           $"MaxWatt: {rapport.MaxWattSessionCycling} \n";
                }
                else if (running == true)
                {
                    rapport = m.GenerateMonthlyRunningReport(year, month);
                    trainingPerMonthDataGrid.ItemsSource = rapport.Runs;
                    trainingPerMonthDataGrid.Items.Refresh();
                    //beste toevoegen
                    besteTrainingen.Text = "RunningSession \n" +
                                           "----------------\n" +
                                           $"MaxDistance: {rapport.MaxDistanceSessionRunning} m \n" +
                                           $"MaxSpeed: {rapport.MaxSpeedSessionRunning} m/s \n";
                }
                else
                {
                    throw new ArgumentException("Please check at least one checkbox");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Home", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Ejemplo n.º 13
0
        private void go_Click(object sender, RoutedEventArgs e)
        {
            int jaarT  = 0;
            int maandT = 0;

            if (int.TryParse(inputYear.Text.Trim(), out int inputInt))
            {
                jaarT = inputInt;
            }
            if (int.TryParse(inputMonth.Text.Trim(), out int input2))
            {
                maandT = input2;
            }
            Report r = training.GenerateMonthlyCyclingReport(jaarT, maandT);

            if (list.SelectedItem != null)
            {
                if (list.SelectedIndex == 0)
                {
                    output.Text = "";
                    var maxDistance = r.MaxDistanceSessionCycling.ToString();
                    output.Text += maxDistance;
                }
                if (list.SelectedIndex == 1)
                {
                    output.Text = "";
                    var maxWatt = r.MaxWattSessionCycling.ToString();
                    output.Text += maxWatt;
                }
                if (list.SelectedIndex == 2)
                {
                    output.Text = "";
                    var maxSpeed = r.MaxSpeedSessionCycling.ToString();
                    output.Text += maxSpeed;
                }
                if (list.SelectedIndex == 3)
                {
                    output.Text = "";
                    var rides = r.Rides;
                    foreach (var ride in rides)
                    {
                        output.Text += ride.ToString() + "\n";
                    }
                }
                if (list.SelectedIndex == 4)
                {
                    output.Text = "";

                    var totalDistance = r.TotalCyclingDistance.ToString();
                    output.Text += totalDistance;
                }
                if (list.SelectedIndex == 5)
                {
                    output.Text = "";
                    var totalCyclinglTrainingTime = r.TotalCyclingTrainingTime.ToString();
                    output.Text += totalCyclinglTrainingTime;
                }
            }
            var totalSessions     = r.TotalSessions.ToString();
            var totalTrainingTime = r.TotalTrainingTime.ToString();

            outputTotal.Text = "Total Training Time: " + totalTrainingTime + "\n" + "Total Sessions: " + totalSessions + "\n";
        }
Ejemplo n.º 14
0
        public void TestMonthlyCyclingReport()
        {
            //Arrange
            TrainingManager addingManager   = new TrainingManager(new UnitOfWork(new TrainingContextTest()));
            DateTime        fastestRideTime = new DateTime(2010, 4, 12);
            DateTime        ignoredRideTime = new DateTime(2000, 2, 5);
            DateTime        longestRideTime = new DateTime(2010, 4, 10);
            DateTime        wattestRideTime = new DateTime(2005, 8, 6);

            CyclingSession fastestRide = new CyclingSession(fastestRideTime, 20, new TimeSpan(1, 0, 0), null, 30, TrainingType.Endurance, null, BikeType.CityBike);
            CyclingSession secFastRide = new CyclingSession(ignoredRideTime, 20, new TimeSpan(5, 0, 0), null, 35, TrainingType.Endurance, null, BikeType.CityBike);
            CyclingSession longestRide = new CyclingSession(longestRideTime, 25, new TimeSpan(10, 0, 0), null, 25, TrainingType.Endurance, null, BikeType.CityBike);
            CyclingSession wattestRide = new CyclingSession(wattestRideTime, 10, new TimeSpan(1, 0, 0), null, 200, TrainingType.Endurance, null, BikeType.CityBike);

            addingManager.AddCyclingTraining(fastestRide.When, fastestRide.Distance, fastestRide.Time, fastestRide.AverageSpeed, fastestRide.AverageWatt, fastestRide.TrainingType, fastestRide.Comments, fastestRide.BikeType);
            addingManager.AddCyclingTraining(secFastRide.When, secFastRide.Distance, secFastRide.Time, secFastRide.AverageSpeed, secFastRide.AverageWatt, secFastRide.TrainingType, secFastRide.Comments, secFastRide.BikeType);
            addingManager.AddCyclingTraining(longestRide.When, longestRide.Distance, longestRide.Time, longestRide.AverageSpeed, longestRide.AverageWatt, longestRide.TrainingType, longestRide.Comments, longestRide.BikeType);
            addingManager.AddCyclingTraining(wattestRide.When, wattestRide.Distance, wattestRide.Time, wattestRide.AverageSpeed, wattestRide.AverageWatt, wattestRide.TrainingType, wattestRide.Comments, wattestRide.BikeType);

            DateTime secondRideTime = new DateTime(2010, 5, 10);
            DateTime firstRideTime  = new DateTime(2010, 5, 1);
            DateTime thirdRideTime  = new DateTime(2010, 5, 31);
            DateTime laterRideTime  = new DateTime(2010, 6, 1);
            DateTime earlyRideTime  = new DateTime(2010, 4, 30);

            CyclingSession secondRide = new CyclingSession(secondRideTime, 5, new TimeSpan(1, 0, 0), null, 10, TrainingType.Endurance, null, BikeType.CityBike);
            CyclingSession firstRide  = new CyclingSession(firstRideTime, 5, new TimeSpan(1, 0, 0), null, 50, TrainingType.Endurance, null, BikeType.CityBike);
            CyclingSession thirdRide  = new CyclingSession(thirdRideTime, 5, new TimeSpan(1, 0, 0), null, 30, TrainingType.Endurance, null, BikeType.CityBike);
            CyclingSession laterRide  = new CyclingSession(laterRideTime, 5, new TimeSpan(1, 0, 0), null, 20, TrainingType.Endurance, null, BikeType.CityBike);
            CyclingSession earlyRide  = new CyclingSession(earlyRideTime, 5, new TimeSpan(1, 0, 0), null, 15, TrainingType.Endurance, null, BikeType.CityBike);

            addingManager.AddCyclingTraining(secondRide.When, secondRide.Distance, secondRide.Time, secondRide.AverageSpeed, secondRide.AverageWatt, secondRide.TrainingType, secondRide.Comments, secondRide.BikeType);
            addingManager.AddCyclingTraining(firstRide.When, firstRide.Distance, firstRide.Time, firstRide.AverageSpeed, firstRide.AverageWatt, firstRide.TrainingType, firstRide.Comments, firstRide.BikeType);
            addingManager.AddCyclingTraining(thirdRide.When, thirdRide.Distance, thirdRide.Time, thirdRide.AverageSpeed, thirdRide.AverageWatt, thirdRide.TrainingType, thirdRide.Comments, thirdRide.BikeType);
            addingManager.AddCyclingTraining(laterRide.When, laterRide.Distance, laterRide.Time, laterRide.AverageSpeed, laterRide.AverageWatt, laterRide.TrainingType, laterRide.Comments, laterRide.BikeType);
            addingManager.AddCyclingTraining(earlyRide.When, earlyRide.Distance, earlyRide.Time, earlyRide.AverageSpeed, earlyRide.AverageWatt, earlyRide.TrainingType, earlyRide.Comments, earlyRide.BikeType);

            //Act
            TrainingManager reportManager = new TrainingManager(new UnitOfWork(new TrainingContextTest(true)));
            int             reportYear    = 2010;
            int             reportMonth   = 5;
            Report          report        = reportManager.GenerateMonthlyCyclingReport(reportYear, reportMonth);

            //Assert
            Assert.AreEqual(report.StartDate, new DateTime(reportYear, reportMonth, 1), "StartDate dit not match up");
            Assert.AreEqual(report.EndDate, new DateTime(reportYear, reportMonth, DateTime.DaysInMonth(reportYear, reportMonth)), "EndDate did not match up");

            Assert.IsNull(report.Runs, "Runs was not null");
            Assert.AreEqual(report.CyclingSessions, 3, "Number of CyclingSessions was incorrect");
            Assert.AreEqual(report.TotalSessions, 3, "Number of TotalSessions was incorrect");
            Assert.AreEqual(report.Rides[0].When, firstRideTime, "The first element in Ridesdit not match,probably not sorted by date properly");
            Assert.AreEqual(report.Rides[1].When, secondRideTime, "The second element in Rides dit not match");
            Assert.AreEqual(report.Rides[2].When, thirdRideTime, "The third element in Rides dit not match");

            Assert.AreEqual(report.MaxDistanceSessionCycling.When, longestRideTime, "Max Distance Ride did not match up");
            Assert.AreEqual(report.MaxSpeedSessionCycling.When, fastestRideTime, "Max Speed Ride did not match up");
            Assert.AreEqual(report.MaxWattSessionCycling.When, wattestRideTime, "Max Watt Ride did not match up");
            Assert.AreEqual(report.TotalCyclingDistance, secondRide.Distance + firstRide.Distance + thirdRide.Distance);
            Assert.AreEqual(report.TotalCyclingTrainingTime, secondRide.Time + firstRide.Time + thirdRide.Time);

            Assert.AreEqual(report.TimeLine[0].Item2, report.Rides[0], "Rides and Timeline did not match up");
            Assert.AreEqual(report.TimeLine[1].Item2, report.Rides[1], "Rides and Timeline did not match up");
            Assert.AreEqual(report.TimeLine[2].Item2, report.Rides[2], "Rides and Timeline did not match up");
        }