Exemplo n.º 1
0
        public ActionResult Index()
        {
            SurveyStatisticsViewModel statistics = SurveyStatisticsViewModel.ToStatistics(db.Surveys.ToList());


            ViewBag.Comments = statistics.Comments;
            ViewBag.Results  = statistics.GetNumbers();

            return(View());
        }
Exemplo n.º 2
0
        public void TestToStatistics()
        {
            List <Survey>             surveys = CreateSurveys();
            SurveyStatisticsViewModel stats   = SurveyStatisticsViewModel.ToStatistics(surveys);

            Assert.AreEqual(10, stats.TotalSurveys);
            Assert.AreEqual(10, stats.Comments.Count());
            Assert.IsTrue(IsBetween(5, 10, stats.AverageBathroom));
            Assert.IsTrue(IsBetween(5, 10, stats.AverageFood));
            Assert.IsTrue(IsBetween(5, 10, stats.AverageMovie));
            Assert.IsTrue(IsBetween(5, 10, stats.AverageOverall));
            Assert.IsTrue(IsBetween(5, 10, stats.AverageShop));
            Assert.IsTrue(IsBetween(5, 10, stats.AverageStaff));
            Assert.IsTrue(IsBetween(5, 10, stats.AverageTravel));
        }