public void NotesContent_WritesDayModel()
        {
            Calculations.NowTime = new DateTime(2017, 1, 27);
            TimeMerge.Model.SingleDayData dayData = new TimeMerge.Model.SingleDayData()
            {
                Day = Calculations.NowTime.Day, IsNoWorkDay = false
            };
            var dayViewModel = new SingleDayViewModel();

            dayViewModel.ReInit(dayData, null, null);
            var fakeMonthVM = new FakeMonthViewModel()
            {
                ForcedYearMonth = Calculations.NowTime
            };

            fakeMonthVM.AddDayVM(dayViewModel);
            var dayModel = (from dayVM in fakeMonthVM.Days.AsQueryable()
                            where dayVM.GetDayData().Day == Calculations.NowTime.Day
                            select dayVM.GetDayData()).FirstOrDefault();
            var notesPanelVM = new NotesPanelViewModel(fakeMonthVM, Calculations.NowTime.Day);

            notesPanelVM.NotesContent = "abc\ndef";

            Assert.AreEqual(notesPanelVM.NotesContent, dayModel.NotesContent);
        }
Esempio n. 2
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
        }
Esempio n. 3
0
        public void GetDeskBandInfo_ReturnsBalanceWholeMonth_Always()
        {
            TimeSpan           monthBalance = TimeSpan.FromMinutes(3 * 60 + 10);
            FakeMonthViewModel monthVM      = new FakeMonthViewModel();

            monthVM.ForcedBalanceWholeMonth = monthBalance;

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

            Assert.AreEqual("+3:10", deskBandString);
        }
        public void NotesTitleText_AccordingToDayInMonth()
        {
            Calculations.NowTime = new DateTime(2017, 1, 27);
            var fakeMonthVM = new FakeMonthViewModel()
            {
                ForcedYearMonth = Calculations.NowTime
            };
            var notesPanelVM = new NotesPanelViewModel(fakeMonthVM, Calculations.NowTime.Day);

            string notesTitle = notesPanelVM.NotesTitleText;

            Assert.AreEqual(notesPanelVM.NotesTitleTextPrefix + "piatok, 27. januára 2017", notesTitle);
        }
Esempio n. 5
0
        public void GetDeskBandInfo_ReturnsZeroHoursZeroMinutes_WhenCurrentDayDurationEmpty()
        {
            Calculations.NowTime = new DateTime(2015, 4, 1);
            TimeSpan           monthBalance = TimeSpan.FromMinutes(3 * 60 + 10);
            FakeMonthViewModel monthVM      = new FakeMonthViewModel()
            {
                ForcedYearMonth = Calculations.NowTime
            };

            monthVM.ForcedBalanceWholeMonth = monthBalance;

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

            Assert.AreEqual("0:00", deskBandString); // instead of month balance of "+3:10"
        }
Esempio n. 6
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"
        }