Пример #1
0
        public void GetPieViewModel_ShouldBeNull_WhenCannotFindReport()
        {
            var reports = new List<WeeklyTaskReport>{_IuWeeklyTaskReport};
            var model = new DailyReportViewModel(reports);
            var result = model.GetPieChartViewModels(EisenHowerType.NotImportantAndUrgent);

            Assert.AreEqual(null, result);
        }
Пример #2
0
 public async Task<ActionResult> Index()
 {
     var userId = User.Identity.GetUserId<int>();
     var lastWeekIndex = GetWeekIndex(DateTime.Now)-1;
     var weeklyTaskData = await ReportRepository.GetWeeklyTaskReportAsync(userId, lastWeekIndex);
     var dailyTaskData = await ReportRepository.GetDailyTaskReportAsync(userId);
     var reportViewModel = new DailyReportViewModel(weeklyTaskData,dailyTaskData);
     return View("Index", reportViewModel);
 }
Пример #3
0
        public void GetIuPieViewModel_ShouldBeCorrect()
        {
            var reports = new List<WeeklyTaskReport>{_IuWeeklyTaskReport};
            var model = new DailyReportViewModel(reports);
            var result = model.GetPieChartViewModels(EisenHowerType.ImportantAndUrgent);

            Assert.AreEqual(2,result.Count);
            Assert.AreEqual(20,result[0].Value);
            Assert.AreEqual(100,result[1].Value);
        }
Пример #4
0
        public void GetNiuPieViewModel_ShouldBeCorrect()
        {
            var reports = new List<WeeklyTaskReport>{new WeeklyTaskReport
            {
                EisenHowerType = EisenHowerType.NotImportantAndUrgent,
                CompletedCount = 100,
                FailedCount = 20,
                TotalCount = 120
            }};
            var model = new DailyReportViewModel(reports);
            var result = model.GetPieChartViewModels(EisenHowerType.NotImportantAndUrgent);

            Assert.AreEqual(2,result.Count);
            Assert.AreEqual(20,result[0].Value);
            Assert.AreEqual(100,result[1].Value);
        }