Exemplo n.º 1
0
        public void GetDeskBandInfo_ReturnsUnknownDuration_WhenCalledForMonthInThePast()
        {
            TimeSpan           monthBalance = TimeSpan.FromMinutes(3 * 60 + 10);
            FakeMonthViewModel monthVM      = new FakeMonthViewModel()
            {
                ForcedYearMonth = new DateTime(2015, 2, 1)
            };

            monthVM.ForcedBalanceWholeMonth = monthBalance;
            Calculations.NowTime            = new DateTime(2015, 5, 3);
            FakeDayViewModel dayVm1 = new FakeDayViewModel()
            {
                ForcedDay = 1, ForcedDuration = TimeSpan.FromHours(6.5)
            };
            FakeDayViewModel dayVm2 = new FakeDayViewModel()
            {
                ForcedDay = 2, ForcedDuration = TimeSpan.FromHours(7.0)
            };
            FakeDayViewModel dayVm3 = new FakeDayViewModel()
            {
                ForcedDay = 3, ForcedDuration = TimeSpan.FromHours(7.5)
            };

            monthVM.AddDayVM(dayVm1);
            monthVM.AddDayVM(dayVm2);
            monthVM.AddDayVM(dayVm3);

            var    formatter      = new DeskBandInfoCurrentDayOnlyFormatter();
            string deskBandString = formatter.GetDeskBandString(monthVM);

            Assert.AreEqual("???", deskBandString); // can only be calculated for the current month, but not for months in the past
        }
Exemplo n.º 2
0
        public void GetDeskBandInfo_ReturnsCurrentDayDuration_WhenCurrentDayDurationNotEmpty()
        {
            Calculations.NowTime = new DateTime(2015, 5, 1);
            TimeSpan           monthBalance = TimeSpan.FromMinutes(3 * 60 + 10);
            FakeMonthViewModel monthVM      = new FakeMonthViewModel()
            {
                ForcedYearMonth = Calculations.NowTime
            };

            monthVM.ForcedBalanceWholeMonth = monthBalance;
            FakeDayViewModel dayVm1 = new FakeDayViewModel()
            {
                ForcedDay = 1, ForcedDuration = TimeSpan.FromHours(6.5)
            };

            monthVM.AddDayVM(dayVm1);

            var    formatter      = new DeskBandInfoCurrentDayOnlyFormatter();
            string deskBandString = formatter.GetDeskBandString(monthVM);

            Assert.AreEqual("6:30", deskBandString); // instead of month balance of "+3:10"
        }