public void GetCurrentStatsTest() { profileRepositoryMock.Setup(t => t.RetrieveProfile()).Returns(new List<CurrentStatistic>(){ new CurrentStatistic(){ EventGoalType = "MAX", Exercise = "Squats", LastExecuted = DateTime.Now, Result = "150x5" }, new CurrentStatistic(){ EventGoalType = "MAX", Exercise = "Golf", LastExecuted = DateTime.Now, Result = "8 pins" }, new CurrentStatistic(){ EventGoalType = "MAX", Exercise = "Run", LastExecuted = DateTime.Now, Result = "1 mile" } }); ProfileController controller = new ProfileController(profileRepositoryMock.Object); var results = controller.Get("test") as IEnumerable<CurrentLiftsViewModel>; Assert.IsNotNull(results); Assert.AreEqual(3, results.Count()); Assert.AreEqual("Golf", results.First(t => t.Result.Equals("8 pins")).Event); }
public void GetCurrentStatsNoneTest() { IList<CurrentStatistic> stats = null; profileRepositoryMock.Setup(t => t.RetrieveProfile()).Returns(stats); ProfileController controller = new ProfileController(profileRepositoryMock.Object); var results = controller.Get("test") as IEnumerable<CurrentLiftsViewModel>; Assert.IsNotNull(results); Assert.AreEqual(0, results.Count()); }