public void GetExercisesSavedForADayNoneTest()
        {
            Workout workout = null;
            workoutRepositoryMock.Setup(t => t.GetWorkout(It.IsAny<DateTime>())).Returns(workout);

            WorkoutController controller = new WorkoutController(workoutRepositoryMock.Object, workoutFactoryMock.Object);
            var results = controller.Get(DateTime.Now) as IEnumerable<SaveExerciseViewModel>;

            Assert.IsNotNull(results);
            Assert.AreEqual(0, results.Count());
        }
        public void GetWorkoutDatesNoneTest()
        {
            IList<DateTime> dates = null;
            workoutRepositoryMock.Setup(t => t.GetWorkoutDates()).Returns(dates);

            WorkoutController controller = new WorkoutController(workoutRepositoryMock.Object, workoutFactoryMock.Object);
            var results = controller.Get() as IEnumerable<DateTime>;

            Assert.IsNull(results);
        }
        public void GetExercisesSavedForADayTest()
        {
            workoutRepositoryMock.Setup(t => t.GetWorkout(It.IsAny<DateTime>())).Returns(new Workout(){
                ExerciseEntries = new List<ExerciseEntry>(){
                    new ExerciseEntry(){
                        Distance = 1,
                        ExerciseId = 1,
                        Name = "bench",
                        Reps = 5,
                        Weight = 1
                    },
                    new ExerciseEntry(){
                        Distance = 1,
                        ExerciseId = 1,
                        Name = "squat",
                        Reps = 10,
                        Weight = 1
                    },
                    new ExerciseEntry(){
                        Distance = 1,
                        ExerciseId = 1,
                        Name = "golf",
                        Reps = 15,
                        Weight = 1
                    }
                },
                WorkoutDate = new DateTime(2010,1,1)
            });

            WorkoutController controller = new WorkoutController(workoutRepositoryMock.Object, workoutFactoryMock.Object);
            var results = controller.Get(DateTime.Now) as IEnumerable<SaveExerciseViewModel>;

            Assert.IsNotNull(results);
            Assert.AreEqual(3, results.Count());
            Assert.AreEqual("golf", results.First(t => t.Reps == 15).Name);
        }
        public void GetWorkoutDatesTest()
        {
            workoutRepositoryMock.Setup(t => t.GetWorkoutDates()).Returns(new List<DateTime>(){
                new DateTime(2010,1,1),
                new DateTime(2011,1,1),
                new DateTime(2012,1,1)
            });

            WorkoutController controller = new WorkoutController(workoutRepositoryMock.Object, workoutFactoryMock.Object);
            var results = controller.Get() as IEnumerable<DateTime>;

            Assert.IsNotNull(results);
            Assert.AreEqual(3, results.Count());
            Assert.IsTrue(results.Contains(new DateTime(2010,1,1)));
        }