public void SetUp() { _circuitLogRepositoryMock = new Mock <ICircuitLogRepository>(); _circuitLogRepositoryMock.Setup(x => x.Get()).Returns(new List <CircuitLog> { new CircuitLog { WorkoutDate = DateTime.Now }, new CircuitLog { WorkoutDate = DateTime.Now.AddDays(-5) }, new CircuitLog { WorkoutDate = DateTime.Now.AddDays(-7) }, new CircuitLog { WorkoutDate = DateTime.Now.AddDays(-8) }, new CircuitLog { WorkoutDate = DateTime.Now.AddDays(-9) } }); _service = new CircuitLogService(_circuitLogRepositoryMock.Object); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); var circuitLogRepository = new CircuitLogRepository(); var meditationLogRepository = new MeditationLogRepository(); var waterLogRepository = new WaterLogRepository(); var physioCircuitWorkout = new PhysioCircuit(); physioCircuitWorkout.LogList.AddRange(circuitLogRepository.Get()); _circuitLogService = new CircuitLogService(circuitLogRepository); var workouts = new List <Workout>() { physioCircuitWorkout }; var meditations = meditationLogRepository.GetForWeek().ToList(); var waterLogs = waterLogRepository.GetForWeek().ToList(); var layout = new LinearLayout(this) { Orientation = Orientation.Vertical }; var table = BuildTableLayoutFromWorkouts(workouts, meditations, waterLogs, this); layout.AddView(table); var reportsHorizontalLayout = new LinearLayout(layout.Context) { Orientation = Orientation.Vertical }; var currentWeekStatsVerticalLayout = new LinearLayout(layout.Context) { Orientation = Orientation.Vertical }; var pointsHistoryVerticalLayout = new LinearLayout(layout.Context) { Orientation = Orientation.Horizontal }; var pointsAggregatesVerticalLayout = new LinearLayout(layout.Context) { Orientation = Orientation.Vertical }; var currentLevelVerticalLayout = new LinearLayout(layout.Context) { Orientation = Orientation.Vertical }; layout.AddView(reportsHorizontalLayout); reportsHorizontalLayout.AddView(currentWeekStatsVerticalLayout); reportsHorizontalLayout.AddView(pointsHistoryVerticalLayout); reportsHorizontalLayout.AddView(pointsAggregatesVerticalLayout); reportsHorizontalLayout.AddView(currentLevelVerticalLayout); currentWeekStatsVerticalLayout.SetPadding(5, 5, 5, 5); pointsHistoryVerticalLayout.SetPadding(5, 5, 5, 5); pointsAggregatesVerticalLayout.SetPadding(5, 5, 5, 5); CreateCurrentWeekStatsSection(workouts, currentWeekStatsVerticalLayout); CreateHistorySection(workouts, pointsHistoryVerticalLayout, pointsAggregatesVerticalLayout); var currentLevelText = new TextView(this) { Text = "Level " + Workout.CURRENT_LEVEL.ToString() }; currentLevelText.SetPadding(5, 5, 5, 5); currentLevelText.SetTextColor(new Color(255, 255, 255)); currentLevelVerticalLayout.AddView(currentLevelText); currentLevelVerticalLayout.AddView ( BuildProgressBarChart ( steps: new int[] { 12, 15, 22 }, goal: 40, title: "Continuous Pushups", icon: Resource.Drawable.Pushups ) ); var crunchesPerDayData = new List <int>(); for (int i = 0; i < 7; i++) { var referenceDate = DateTime.Now.AddDays(-i); var logs = _circuitLogService.SelectRunningWeeksLogsFromWorkouts(referenceDate); var circuit = new PhysioCircuit(logs); var crunchesPerformed = circuit.GetTotalCrunchesPerformed(); var averagePerDay = crunchesPerformed / 7; crunchesPerDayData.Add(averagePerDay); } currentLevelVerticalLayout.AddView ( BuildProgressBarChart ( steps: crunchesPerDayData.ToArray(), goal: 200, title: "Crunches per day", icon: Resource.Drawable.Crunches ) ); currentLevelVerticalLayout.AddView ( BuildProgressBarChart ( steps: new int[] { 50, 60, 67, 68, 66, 63, 50 }, goal: 100, title: "Crunches in a minute", icon: Resource.Drawable.Crunches ) ); SetContentView(layout); }