Exemplo n.º 1
0
        private TimeMerge.Model.SingleDayData getOrCreateSingleDayData(int dayNumber)
        {
            var matchingDays = from TimeMerge.Model.SingleDayData dayData in this._monthData.Days
                               where dayData.Day == dayNumber
                               select dayData;

            TimeMerge.Model.SingleDayData matchingDayData = matchingDays.SingleOrDefault();
            if (matchingDayData == null)
            {
                matchingDayData = new TimeMerge.Model.SingleDayData();
            }

            matchingDayData.Day = dayNumber;
            return(matchingDayData);
        }
Exemplo n.º 2
0
        public void DayDuration_WontAutoSubtractLunchTime_WhenWorkdayTooShort()
        {
            TimeMerge.Utils.Calculations.NowTime = new DateTime(2012, 10, 27, 15, 48, 59);

            // Work Spans:
            // 7:00 - 13:25 (6 hours 25 minutes) the maximum workday duration that does not yet require a lunch break
            var dayData = new TimeMerge.Model.SingleDayData()
            {
                Day = 26, IsNoWorkDay = false
            };

            dayData.WorkSpans[0].StartTime = new DateTime(2012, 10, 26, 7, 0, 0);
            dayData.WorkSpans[0].EndTime   = new DateTime(2012, 10, 26, 13, 25, 0);

            Assert.AreEqual(TimeSpan.FromMinutes(6 * 60 + 25), dayData.Duration);
        }
Exemplo n.º 3
0
        public void ReInit(TimeMerge.Model.SingleDayData dayData, SingleMonthViewModel parentMonthVM, List <TimeMerge.Model.SingleDayData> dayModelsList)
        {
            _dayData       = dayData;
            _parentMonthVM = parentMonthVM;

            // Synchronize the collection of single day ViewModels with collection of single day Models
            if (dayModelsList != null && !dayModelsList.Contains(dayData))
            {
                dayModelsList.Add(dayData);
            }

            if (this.IsNotificationTurnedOn())
            {
                notifyAllPropertiesChanged();
            }
        }
Exemplo n.º 4
0
        public void DayDuration_WontAutoSubtractLunchTime_WhenDayIsBusinessTrip()
        {
            TimeMerge.Utils.Calculations.NowTime = new DateTime(2012, 10, 27, 15, 48, 59);

            // Work Interruptions:
            // 7:00 - 15:00 (8 hours) SLUZ
            var dayData = new TimeMerge.Model.SingleDayData()
            {
                Day = 26, IsNoWorkDay = false
            };

            dayData.WorkInterruptions[0].StartTime = new DateTime(2012, 10, 26, 7, 0, 0);
            dayData.WorkInterruptions[0].EndTime   = new DateTime(2012, 10, 26, 15, 0, 0);
            dayData.WorkInterruptions[0].Type      = TimeMerge.Model.WorkInterruption.WorkInterruptionType.SLUZ;

            Assert.AreEqual(TimeSpan.FromMinutes(8 * 60), dayData.Duration);
        }
Exemplo n.º 5
0
        public void DayDuration_WontAutoSubtractLunchTime_WhenDayContainsSomeVacation()
        {
            TimeMerge.Utils.Calculations.NowTime = new DateTime(2012, 10, 27, 15, 48, 59);

            // Work Spans:
            // 7:00 - 11:00 (4 hours)
            // Work Interruptions:
            // 11:00 - 15:00 (4 hours) DOV
            var dayData = new TimeMerge.Model.SingleDayData()
            {
                Day = 26, IsNoWorkDay = false
            };

            dayData.WorkSpans[0].StartTime         = new DateTime(2012, 10, 26, 7, 0, 0);
            dayData.WorkSpans[0].EndTime           = new DateTime(2012, 10, 26, 11, 0, 0);
            dayData.WorkInterruptions[0].StartTime = new DateTime(2012, 10, 26, 11, 0, 0);
            dayData.WorkInterruptions[0].EndTime   = new DateTime(2012, 10, 26, 15, 0, 0);
            dayData.WorkInterruptions[0].Type      = TimeMerge.Model.WorkInterruption.WorkInterruptionType.DOV;

            Assert.AreEqual(TimeSpan.FromMinutes(8 * 60), dayData.Duration);
        }
Exemplo n.º 6
0
        public void WorkSpan0ToolTip_UsesInvariantCulture_Always()
        {
            var oldCulture = Thread.CurrentThread.CurrentCulture;

            Thread.CurrentThread.CurrentCulture  = new System.Globalization.CultureInfo("sk");
            TimeMerge.Utils.Calculations.NowTime = new DateTime(2012, 10, 26, 11, 11, 59);
            var mainVM = new FakeMainViewModel();

            mainVM.Init();
            var monthData = new TimeMerge.Model.SingleMonthData()
            {
                YearMonth = new DateTime(2012, 10, 1)
            };

            mainVM.MonthViewModel.SetMonthData(monthData);
            TimeMerge.Model.SingleDayData dayData = new TimeMerge.Model.SingleDayData()
            {
                Day = 26, IsNoWorkDay = false
            };

            //               now |11:11|
            // 6:36 -
            dayData = new TimeMerge.Model.SingleDayData()
            {
                Day = 26, IsNoWorkDay = false
            };
            dayData.WorkInterruptions[0].CorrectionStartTime = new DateTime(2012, 10, 26, 6, 36, 0);
            //             dayData.WorkInterruptions[0].EndTime = new DateTime(2012, 10, 26, 12, 10, 0);
            dayData.WorkInterruptions[0].CorrectedType = WorkInterruption.WorkInterruptionType.PDOMA;
            TimeMerge.ViewModel.SingleDayViewModel dayVM = new TimeMerge.ViewModel.SingleDayViewModel();
            dayVM.ReInit(dayData, mainVM.MonthViewModel, monthData.Days);
            mainVM.MonthViewModel.Days.Add(dayVM);

            string tooltip = dayVM.Interrupt0ToolTip;

            Assert.AreEqual("Korekcia z 00:00 - 00:00, z typu PDOMA" + System.Environment.NewLine + "+0:00 sa dosiahne o 14:36 (s obedom o 14:56)", tooltip, false);
            Thread.CurrentThread.CurrentCulture = oldCulture;
        }
Exemplo n.º 7
0
        private void extractTimesTable(string tableContent)
        {
            int year  = _monthData.YearMonth.Year;
            int month = _monthData.YearMonth.Month;

            var daysCreatedList     = new List <SingleDayViewModel>();
            int lastDayNumberNeeded = 1;

            Regex exTableRows = new Regex("<tr>.*?<td class=\"r\">(.*?)</td>(.*?)</tr>");
            var   matches     = exTableRows.Matches(tableContent);

            foreach (Match oneRowMatch in matches)
            {
                int  dayNumber   = 0;
                bool isNoWorkDay = false;
                if (oneRowMatch.Groups.Count > 1 && oneRowMatch.Groups[1].Captures.Count > 0)
                {
                    var dayNumberString = oneRowMatch.Groups[1].Captures[0].Value;
                    if (dayNumberString.Contains("&gt;") && dayNumberString.Contains("&lt;"))
                    {
                        isNoWorkDay     = true;
                        dayNumberString = dayNumberString.Replace("&gt;", "");
                        dayNumberString = dayNumberString.Replace("&lt;", "");
                    }
                    else if (dayNumberString.StartsWith("=") && dayNumberString.EndsWith("="))
                    {
                        isNoWorkDay     = true;
                        dayNumberString = dayNumberString.Replace("=", "");
                    }
                    if (!Int32.TryParse(dayNumberString, out dayNumber))
                    {
                        continue; // cannot parse day number!
                    }
                    lastDayNumberNeeded = dayNumber;
                }
                if (oneRowMatch.Groups.Count > 2 && oneRowMatch.Groups[2].Captures.Count > 0)
                {
                    string oneDayData = oneRowMatch.Groups[2].Captures[0].Value;
                    oneDayData = oneDayData.Replace("&nbsp;", " ");

                    Regex exFourthToNinethCell = new Regex("(<td.*?>(.*?)</td>.*?){47}");
                    var   tdMatches            = exFourthToNinethCell.Matches(oneDayData);
                    foreach (Match oneTdMatch in tdMatches)
                    {
                        if (oneTdMatch.Groups.Count > 1 && oneTdMatch.Groups[2].Captures.Count > 46)
                        {
                            bool isNewDayVMToBeAdded = false;
                            IEnumerable <SingleDayViewModel> dayVMsMatchingThisDay = from oneDayVM in _days
                                                                                     where oneDayVM.Day == dayNumber
                                                                                     select oneDayVM;
                            var dayVM = dayVMsMatchingThisDay.FirstOrDefault();
                            if (dayVM == null)
                            {
                                isNewDayVMToBeAdded = true;

                                dayVM = new SingleDayViewModel();
                            }
                            TimeMerge.Model.SingleDayData dayData = getOrCreateSingleDayData(dayNumber);
                            dayVM.ReInit(dayData, this, this._monthData.Days);

                            dayVM.IsNoWorkDay = isNoWorkDay;

                            dayVM.IsChangeByUserAllowed = false;

                            dayVM.WorkSpan0Start = oneTdMatch.Groups[2].Captures[3].Value;
                            dayVM.WorkSpan0End   = oneTdMatch.Groups[2].Captures[4].Value;
                            dayVM.WorkSpan1Start = oneTdMatch.Groups[2].Captures[5].Value;
                            dayVM.WorkSpan1End   = oneTdMatch.Groups[2].Captures[6].Value;
                            dayVM.WorkSpan2Start = oneTdMatch.Groups[2].Captures[7].Value;
                            dayVM.WorkSpan2End   = oneTdMatch.Groups[2].Captures[8].Value;

                            dayVM.WorkSpan3Start = oneTdMatch.Groups[2].Captures[9].Value;
                            dayVM.WorkSpan3End   = oneTdMatch.Groups[2].Captures[10].Value;
                            dayVM.WorkSpan4Start = oneTdMatch.Groups[2].Captures[11].Value;
                            dayVM.WorkSpan4End   = oneTdMatch.Groups[2].Captures[12].Value;
                            dayVM.WorkSpan5Start = oneTdMatch.Groups[2].Captures[13].Value;
                            dayVM.WorkSpan5End   = oneTdMatch.Groups[2].Captures[14].Value;
                            dayVM.WorkSpan6Start = oneTdMatch.Groups[2].Captures[15].Value;
                            dayVM.WorkSpan6End   = oneTdMatch.Groups[2].Captures[16].Value;
                            dayVM.WorkSpan7Start = oneTdMatch.Groups[2].Captures[17].Value;
                            dayVM.WorkSpan7End   = oneTdMatch.Groups[2].Captures[18].Value;
                            dayVM.WorkSpan8Start = oneTdMatch.Groups[2].Captures[19].Value;
                            dayVM.WorkSpan8End   = oneTdMatch.Groups[2].Captures[20].Value;
                            dayVM.WorkSpan9Start = oneTdMatch.Groups[2].Captures[21].Value;
                            dayVM.WorkSpan9End   = oneTdMatch.Groups[2].Captures[22].Value;

                            dayVM.Interrupt0Start = oneTdMatch.Groups[2].Captures[23].Value;
                            dayVM.Interrupt0End   = oneTdMatch.Groups[2].Captures[24].Value;
                            dayVM.Interrupt0Type  = WorkInterruption.ParseInterruptionType(oneTdMatch.Groups[2].Captures[25].Value);
                            dayVM.Interrupt1Start = oneTdMatch.Groups[2].Captures[26].Value;
                            dayVM.Interrupt1End   = oneTdMatch.Groups[2].Captures[27].Value;
                            dayVM.Interrupt1Type  = WorkInterruption.ParseInterruptionType(oneTdMatch.Groups[2].Captures[28].Value);
                            dayVM.Interrupt2Start = oneTdMatch.Groups[2].Captures[29].Value;
                            dayVM.Interrupt2End   = oneTdMatch.Groups[2].Captures[30].Value;
                            dayVM.Interrupt2Type  = WorkInterruption.ParseInterruptionType(oneTdMatch.Groups[2].Captures[31].Value);
                            dayVM.Interrupt3Start = oneTdMatch.Groups[2].Captures[32].Value;
                            dayVM.Interrupt3End   = oneTdMatch.Groups[2].Captures[33].Value;
                            dayVM.Interrupt3Type  = WorkInterruption.ParseInterruptionType(oneTdMatch.Groups[2].Captures[34].Value);
                            dayVM.Interrupt4Start = oneTdMatch.Groups[2].Captures[35].Value;
                            dayVM.Interrupt4End   = oneTdMatch.Groups[2].Captures[36].Value;
                            dayVM.Interrupt4Type  = WorkInterruption.ParseInterruptionType(oneTdMatch.Groups[2].Captures[37].Value);
                            dayVM.Interrupt5Start = oneTdMatch.Groups[2].Captures[38].Value;
                            dayVM.Interrupt5End   = oneTdMatch.Groups[2].Captures[39].Value;
                            dayVM.Interrupt5Type  = WorkInterruption.ParseInterruptionType(oneTdMatch.Groups[2].Captures[40].Value);
                            dayVM.Interrupt6Start = oneTdMatch.Groups[2].Captures[41].Value;
                            dayVM.Interrupt6End   = oneTdMatch.Groups[2].Captures[42].Value;
                            dayVM.Interrupt6Type  = WorkInterruption.ParseInterruptionType(oneTdMatch.Groups[2].Captures[43].Value);
                            dayVM.Interrupt7Start = oneTdMatch.Groups[2].Captures[44].Value;
                            dayVM.Interrupt7End   = oneTdMatch.Groups[2].Captures[45].Value;
                            dayVM.Interrupt7Type  = WorkInterruption.ParseInterruptionType(oneTdMatch.Groups[2].Captures[46].Value);

                            dayVM.IsChangeByUserAllowed = true;

                            if (isNewDayVMToBeAdded)
                            {
                                daysCreatedList.Add(dayVM);
                            }
                        }
                    }
                }
            }

            IEnumerable <SingleDayViewModel> daysDeleted = from oneDayVM in _days
                                                           where oneDayVM.Day > lastDayNumberNeeded
                                                           select oneDayVM;
            var daysDeletedList = daysDeleted.ToList(); // make the enumeration of IEnumerable<> happen right now, so that '_days' collection changes won't affect the 'Remove()' calls below

            App.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                foreach (SingleDayViewModel singleDayVM in daysCreatedList)
                {
                    _days.Add(singleDayVM);
                }

                foreach (SingleDayViewModel singleDayVM in daysDeletedList)
                {
                    _days.Remove(singleDayVM);
                }
            }));
        }
Exemplo n.º 8
0
        public void GetLunchDurationTest()
        {
            TimeMerge.Utils.Calculations.NowTime = new DateTime(2012, 10, 26, 15, 48, 59);

            var mainVM = new FakeMainViewModel();

            mainVM.Init();

            var monthData = new TimeMerge.Model.SingleMonthData()
            {
                YearMonth = new DateTime(2012, 10, 1)
            };

            mainVM.MonthViewModel.SetMonthData(monthData);

            TimeMerge.Model.SingleDayData          dayData;
            TimeMerge.ViewModel.SingleDayViewModel dayVM = new TimeMerge.ViewModel.SingleDayViewModel();



            // Work Spans:
            // 7:00 - 14:00
            dayData = new TimeMerge.Model.SingleDayData()
            {
                Day = 26, IsNoWorkDay = false
            };
            dayData.WorkSpans[0].StartTime = new DateTime(2012, 10, 26, 7, 0, 0);
            dayData.WorkSpans[0].EndTime   = new DateTime(2012, 10, 26, 14, 0, 0);
            dayVM.ReInit(dayData, mainVM.MonthViewModel, monthData.Days);

            Assert.AreEqual(TimeSpan.FromMinutes(0), dayVM.GetLunchDuration());


            // Work Spans:                                  Work Interruptions:
            // 7:00 - 12:00   12:20 - 15:00                 12:00 - 12:10 [OBED]   12:10 - 12:20 [OBED]
            dayData = new TimeMerge.Model.SingleDayData()
            {
                Day = 26, IsNoWorkDay = false
            };
            dayData.WorkSpans[0].StartTime         = new DateTime(2012, 10, 26, 7, 0, 0);
            dayData.WorkSpans[0].EndTime           = new DateTime(2012, 10, 26, 12, 0, 0);
            dayData.WorkSpans[1].StartTime         = new DateTime(2012, 10, 26, 12, 20, 0);
            dayData.WorkSpans[1].EndTime           = new DateTime(2012, 10, 26, 15, 0, 0);
            dayData.WorkInterruptions[0].StartTime = new DateTime(2012, 10, 26, 12, 0, 0);
            dayData.WorkInterruptions[0].EndTime   = new DateTime(2012, 10, 26, 12, 10, 0);
            dayData.WorkInterruptions[0].Type      = WorkInterruption.WorkInterruptionType.OBED;
            dayData.WorkInterruptions[1].StartTime = new DateTime(2012, 10, 26, 12, 10, 0);
            dayData.WorkInterruptions[1].EndTime   = new DateTime(2012, 10, 26, 12, 20, 0);
            dayData.WorkInterruptions[1].Type      = WorkInterruption.WorkInterruptionType.OBED;
            dayVM.ReInit(dayData, mainVM.MonthViewModel, monthData.Days);

            Assert.AreEqual(TimeSpan.FromMinutes(SingleDayData.LunchTimeMinimalTime), dayVM.GetLunchDuration());



            // Work Spans:                                  Work Interruptions:
            //                                              6:36 - . []
            TimeMerge.Utils.Calculations.NowTime = new DateTime(2012, 10, 26, 8, 30, 59);
            dayData = new TimeMerge.Model.SingleDayData()
            {
                Day = 26, IsNoWorkDay = false
            };
            dayData.WorkInterruptions[0].CorrectionStartTime = new DateTime(2012, 10, 26, 6, 36, 0);
            dayVM.ReInit(dayData, mainVM.MonthViewModel, monthData.Days);

            Assert.AreEqual(TimeSpan.FromMinutes(0), dayVM.GetLunchDuration());



            // Work Spans:
            // 7:00 - 9:00   10:30 - 11:00   11:01 - 11:10   11:11 - 11:20   11:31 - 11:40   11:41 - 12:00   12:20 - 15:00
            // Work Interruptions:
            // 9:00 - 10:30 [LEK]   11:00 - 11:01 [ZP]   11:10 - 11:11 [ZP]   11:20 - 11:21 [ZP]   11:21 - 11:31 [ZP]   11:40 - 11:41 [ZP]   12:00 - 12:10 [OBED]   12:10 - 12:20 [OBED]
            dayData = new TimeMerge.Model.SingleDayData()
            {
                Day = 26, IsNoWorkDay = false
            };
            dayData.WorkSpans[0].StartTime         = new DateTime(2012, 10, 26, 7, 0, 0);
            dayData.WorkSpans[0].EndTime           = new DateTime(2012, 10, 26, 9, 0, 0);
            dayData.WorkSpans[1].StartTime         = new DateTime(2012, 10, 26, 10, 30, 0);
            dayData.WorkSpans[1].EndTime           = new DateTime(2012, 10, 26, 11, 0, 0);
            dayData.WorkSpans[2].StartTime         = new DateTime(2012, 10, 26, 11, 1, 0);
            dayData.WorkSpans[2].EndTime           = new DateTime(2012, 10, 26, 11, 10, 0);
            dayData.WorkSpans[3].StartTime         = new DateTime(2012, 10, 26, 11, 11, 0);
            dayData.WorkSpans[3].EndTime           = new DateTime(2012, 10, 26, 11, 20, 0);
            dayData.WorkSpans[4].StartTime         = new DateTime(2012, 10, 26, 11, 31, 0);
            dayData.WorkSpans[4].EndTime           = new DateTime(2012, 10, 26, 11, 40, 0);
            dayData.WorkSpans[5].StartTime         = new DateTime(2012, 10, 26, 11, 41, 0);
            dayData.WorkSpans[5].EndTime           = new DateTime(2012, 10, 26, 12, 0, 0);
            dayData.WorkSpans[6].StartTime         = new DateTime(2012, 10, 26, 12, 20, 0);
            dayData.WorkSpans[6].EndTime           = new DateTime(2012, 10, 26, 15, 0, 0);
            dayData.WorkInterruptions[0].StartTime = new DateTime(2012, 10, 26, 9, 0, 0);
            dayData.WorkInterruptions[0].EndTime   = new DateTime(2012, 10, 26, 10, 30, 0);
            dayData.WorkInterruptions[0].Type      = WorkInterruption.WorkInterruptionType.LEK;
            dayData.WorkInterruptions[1].StartTime = new DateTime(2012, 10, 26, 11, 0, 0);
            dayData.WorkInterruptions[1].EndTime   = new DateTime(2012, 10, 26, 11, 1, 0);
            dayData.WorkInterruptions[1].Type      = WorkInterruption.WorkInterruptionType.ZP;
            dayData.WorkInterruptions[2].StartTime = new DateTime(2012, 10, 26, 11, 10, 0);
            dayData.WorkInterruptions[2].EndTime   = new DateTime(2012, 10, 26, 11, 11, 0);
            dayData.WorkInterruptions[2].Type      = WorkInterruption.WorkInterruptionType.ZP;
            dayData.WorkInterruptions[3].StartTime = new DateTime(2012, 10, 26, 11, 20, 0);
            dayData.WorkInterruptions[3].EndTime   = new DateTime(2012, 10, 26, 11, 21, 0);
            dayData.WorkInterruptions[3].Type      = WorkInterruption.WorkInterruptionType.ZP;
            dayData.WorkInterruptions[4].StartTime = new DateTime(2012, 10, 26, 11, 21, 0);
            dayData.WorkInterruptions[4].EndTime   = new DateTime(2012, 10, 26, 11, 31, 0);
            dayData.WorkInterruptions[4].Type      = WorkInterruption.WorkInterruptionType.ZP;
            dayData.WorkInterruptions[5].StartTime = new DateTime(2012, 10, 26, 11, 40, 0);
            dayData.WorkInterruptions[5].EndTime   = new DateTime(2012, 10, 26, 11, 41, 0);
            dayData.WorkInterruptions[5].Type      = WorkInterruption.WorkInterruptionType.ZP;
            dayData.WorkInterruptions[6].StartTime = new DateTime(2012, 10, 26, 12, 0, 0);
            dayData.WorkInterruptions[6].EndTime   = new DateTime(2012, 10, 26, 12, 10, 0);
            dayData.WorkInterruptions[6].Type      = WorkInterruption.WorkInterruptionType.OBED;
            dayData.WorkInterruptions[7].StartTime = new DateTime(2012, 10, 26, 12, 10, 0);
            dayData.WorkInterruptions[7].EndTime   = new DateTime(2012, 10, 26, 12, 20, 0);
            dayData.WorkInterruptions[7].Type      = WorkInterruption.WorkInterruptionType.OBED;
            dayVM.ReInit(dayData, mainVM.MonthViewModel, monthData.Days);

            Assert.AreEqual(TimeSpan.FromMinutes(SingleDayData.LunchTimeMinimalTime), dayVM.GetLunchDuration());
        }
Exemplo n.º 9
0
        public void TimeToReachZeroBalanceTest()
        {
            TimeMerge.Utils.Calculations.NowTime = new DateTime(2012, 10, 26, 15, 48, 59);

            var mainVM = new FakeMainViewModel();

            mainVM.Init();

            var monthData = new TimeMerge.Model.SingleMonthData()
            {
                YearMonth = new DateTime(2012, 10, 1)
            };

            mainVM.MonthViewModel.SetMonthData(monthData);

            TimeMerge.Model.SingleDayData          dayData;
            TimeMerge.ViewModel.SingleDayViewModel dayVM = new TimeMerge.ViewModel.SingleDayViewModel();

            //                     now |15:48|
            // 7:00 - 14:00
            dayData = new TimeMerge.Model.SingleDayData()
            {
                Day = 26, IsNoWorkDay = false
            };
            dayData.WorkSpans[0].StartTime = new DateTime(2012, 10, 26, 7, 0, 0);
            dayData.WorkSpans[0].EndTime   = new DateTime(2012, 10, 26, 14, 0, 0);
            dayVM.ReInit(dayData, mainVM.MonthViewModel, monthData.Days);

            mainVM.MonthViewModel.Days.Clear();
            mainVM.MonthViewModel.Days.Add(dayVM);
            Assert.IsNull(dayVM.WorkSpan0ToolTip);

            //                     now |15:48|
            // 7:00 - .
            dayData = new TimeMerge.Model.SingleDayData()
            {
                Day = 26, IsNoWorkDay = false
            };
            dayData.WorkSpans[0].StartTime = new DateTime(2012, 10, 26, 7, 0, 0);
            dayData.WorkSpans[0].EndTime   = new DateTime(2012, 10, 26, 0, 0, 0);
            dayVM.ReInit(dayData, mainVM.MonthViewModel, monthData.Days);

            mainVM.MonthViewModel.Days.Clear();
            mainVM.MonthViewModel.Days.Add(dayVM);
            Assert.AreEqual("+0:00 bol dosiahnutý o 15:00 (s obedom o 15:20)", dayVM.WorkSpan0ToolTip, false);

            //                     now |15:48|
            // 10:00 - .
            dayData = new TimeMerge.Model.SingleDayData()
            {
                Day = 26, IsNoWorkDay = false
            };
            dayData.WorkSpans[0].StartTime = new DateTime(2012, 10, 26, 10, 0, 0);
            dayData.WorkSpans[0].EndTime   = new DateTime(2012, 10, 26, 0, 0, 0);
            dayVM.ReInit(dayData, mainVM.MonthViewModel, monthData.Days);

            mainVM.MonthViewModel.Days.Clear();
            mainVM.MonthViewModel.Days.Add(dayVM);
            Assert.AreEqual("+0:00 sa dosiahne o 18:00 (s obedom o 18:20)", dayVM.WorkSpan0ToolTip, false);

            TimeMerge.Utils.Calculations.NowTime = new DateTime(2012, 10, 26, 11, 11, 59);

            //               now |11:11|
            // 7:00 - 9:00                 12:12 - .
            dayData = new TimeMerge.Model.SingleDayData()
            {
                Day = 26, IsNoWorkDay = false
            };
            dayData.WorkSpans[0].StartTime = new DateTime(2012, 10, 26, 7, 0, 0);
            dayData.WorkSpans[0].EndTime   = new DateTime(2012, 10, 26, 9, 0, 0);
            dayData.WorkSpans[1].StartTime = new DateTime(2012, 10, 26, 12, 12, 0);
            dayData.WorkSpans[1].EndTime   = new DateTime(2012, 10, 26, 0, 0, 0);
            dayVM.ReInit(dayData, mainVM.MonthViewModel, monthData.Days);

            mainVM.MonthViewModel.Days.Clear();
            mainVM.MonthViewModel.Days.Add(dayVM);
            Assert.IsNull(dayVM.WorkSpan0ToolTip);
            Assert.AreEqual("+0:00 sa dosiahne o 18:12 (s obedom o 18:32)", dayVM.WorkSpan1ToolTip, false);

            //               now |11:11|
            // 7:00 - 9:00                 12:12 - 18:18
            dayData = new TimeMerge.Model.SingleDayData()
            {
                Day = 26, IsNoWorkDay = false
            };
            dayData.WorkSpans[0].StartTime = new DateTime(2012, 10, 26, 7, 0, 0);
            dayData.WorkSpans[0].EndTime   = new DateTime(2012, 10, 26, 9, 0, 0);
            dayData.WorkSpans[1].StartTime = new DateTime(2012, 10, 26, 12, 12, 0);
            dayData.WorkSpans[1].EndTime   = new DateTime(2012, 10, 26, 18, 18, 0);
            dayVM.ReInit(dayData, mainVM.MonthViewModel, monthData.Days);
            mainVM.MonthViewModel.NotifyPropertyChanged("BalanceWholeMonth");

            mainVM.MonthViewModel.Days.Clear();
            mainVM.MonthViewModel.Days.Add(dayVM);
            Assert.IsNull(dayVM.WorkSpan0ToolTip);
            Assert.IsNull(dayVM.WorkSpan1ToolTip);
            Assert.AreEqual(TimeSpan.FromMinutes(6), mainVM.MonthViewModel.BalanceWholeMonth);



            // Work Spans:                                  Work Interruptions:
            //                                              06:36 - .
            TimeMerge.Utils.Calculations.NowTime = new DateTime(2012, 10, 26, 8, 30, 59);

            dayData = new TimeMerge.Model.SingleDayData()
            {
                Day = 26, IsNoWorkDay = false
            };
            dayData.WorkInterruptions[0].CorrectionStartTime = new DateTime(2012, 10, 26, 6, 36, 0);
            //             dayData.WorkInterruptions[0].EndTime = new DateTime(2012, 10, 26, 12, 10, 0);
            dayData.WorkInterruptions[0].CorrectedType = WorkInterruption.WorkInterruptionType.PDOMA;
            dayVM.ReInit(dayData, mainVM.MonthViewModel, monthData.Days);

            mainVM.MonthViewModel.Days.Clear();
            mainVM.MonthViewModel.Days.Add(dayVM);
            Assert.AreEqual("Korekcia z 00:00 - 00:00, z typu PDOMA" + System.Environment.NewLine + "+0:00 sa dosiahne o 14:36 (s obedom o 14:56)", dayVM.Interrupt0ToolTip, false);



            // Work Spans:                                  Work Interruptions:
            //                                              7:10 - 11:50 [PDOMA]   11:50 - 12:00 [ZP]   12:00 - 12:20 [OBED]   12:20 - . [PDOMA]
            TimeMerge.Utils.Calculations.NowTime = new DateTime(2012, 10, 26, 13, 40, 59);

            dayData = new TimeMerge.Model.SingleDayData()
            {
                Day = 26, IsNoWorkDay = false
            };
            dayData.WorkInterruptions[0].CorrectionStartTime = new DateTime(2012, 10, 26, 7, 10, 0);
            dayData.WorkInterruptions[0].EndTime             = new DateTime(2012, 10, 26, 11, 50, 0);
            dayData.WorkInterruptions[0].CorrectedType       = WorkInterruption.WorkInterruptionType.PDOMA;
            dayData.WorkInterruptions[1].CorrectionStartTime = new DateTime(2012, 10, 26, 11, 50, 0);
            dayData.WorkInterruptions[1].EndTime             = new DateTime(2012, 10, 26, 12, 0, 0);
            dayData.WorkInterruptions[1].CorrectedType       = WorkInterruption.WorkInterruptionType.ZP;
            dayData.WorkInterruptions[2].CorrectionStartTime = new DateTime(2012, 10, 26, 12, 0, 0);
            dayData.WorkInterruptions[2].EndTime             = new DateTime(2012, 10, 26, 12, 20, 0);
            dayData.WorkInterruptions[2].CorrectedType       = WorkInterruption.WorkInterruptionType.OBED;
            dayData.WorkInterruptions[3].CorrectionStartTime = new DateTime(2012, 10, 26, 12, 20, 0);
            // dayData.WorkInterruptions[3].EndTime = new DateTime(2012, 10, 26, 12, 10, 0);
            dayData.WorkInterruptions[3].CorrectedType = WorkInterruption.WorkInterruptionType.PDOMA;
            dayVM.ReInit(dayData, mainVM.MonthViewModel, monthData.Days);

            mainVM.MonthViewModel.Days.Clear();
            mainVM.MonthViewModel.Days.Add(dayVM);
            Assert.AreEqual("Korekcia z 00:00 - 00:00, z typu PDOMA" + System.Environment.NewLine + "+0:00 sa dosiahne o 15:30", dayVM.Interrupt3ToolTip, false);
        }