public void CutRegex6()
 {
     EventLengthFinder elf = new EventLengthFinder("Czas po polsku (5 minut) @home");
     Assert.AreEqual(elf.TaskSummaryWithoutPattern, "Czas po polsku @home");
 }
 public void CalculateTime2()
 {
     EventLengthFinder elf = new EventLengthFinder("@home Read for 45 minutes");
     Assert.AreEqual(elf.TotalMinutes, 45);
 }
 public void CutRegex2()
 {
     EventLengthFinder elf = new EventLengthFinder("@home Read for 45 minutes");
     Assert.AreEqual(elf.TaskSummaryWithoutPattern, "@home Read for");
 }
 public void CutRegex4()
 {
     EventLengthFinder elf = new EventLengthFinder("Meditate 0.5h @home");
     Assert.AreEqual(elf.TaskSummaryWithoutPattern, "Meditate @home");
 }
 public void CalculateTime5()
 {
     EventLengthFinder elf = new EventLengthFinder("Play drums (2h 30 min) @home");
     Assert.AreEqual(elf.TotalMinutes, 2 * 60 + 30);
 }
 public void CalculateTime8()
 {
     EventLengthFinder elf = new EventLengthFinder("Some short thing [5m]");
     Assert.AreEqual(elf.TotalMinutes, 5);
 }
 public void RegexShouldMatch3()
 {
     EventLengthFinder elf = new EventLengthFinder("Exercise @gym 1 H");
     Assert.AreEqual(elf.PatternFound, true);
 }
 public void CalculateTime3()
 {
     EventLengthFinder elf = new EventLengthFinder("Exercise @gym 1 H");
     Assert.AreEqual(elf.TotalMinutes, 60);
 }
 public void RegexShouldMatch1()
 {
     EventLengthFinder elf = new EventLengthFinder("Review english lesson @home 20m");
     Assert.AreEqual(elf.PatternFound, true);
 }
Exemplo n.º 10
0
 public void RegexShouldMatch2()
 {
     EventLengthFinder elf = new EventLengthFinder("@home Read for 45 minutes");
     Assert.AreEqual(elf.PatternFound, true);
 }
Exemplo n.º 11
0
 public void CalculateTime1()
 {
     EventLengthFinder elf = new EventLengthFinder("Review english lesson @home 20m");
     Assert.AreEqual(elf.TotalMinutes, 20);
 }
Exemplo n.º 12
0
 public void NoTimeSpecified1()
 {
     EventLengthFinder elf = new EventLengthFinder("No time specified in this string");
     int totalMinutes = elf.TotalMinutes;
 }
Exemplo n.º 13
0
 public void CutRegex8()
 {
     EventLengthFinder elf = new EventLengthFinder("Some short thing [5m]");
     Assert.AreEqual(elf.TaskSummaryWithoutPattern, "Some short thing");
 }
Exemplo n.º 14
0
 public void RegexShouldNotMatch3()
 {
     EventLengthFinder elf = new EventLengthFinder("123 45 6");
     Assert.AreEqual(elf.PatternFound, false);
 }
Exemplo n.º 15
0
 public void RegexShouldMatch4()
 {
     EventLengthFinder elf = new EventLengthFinder("Meditate 0.5h @home");
     Assert.AreEqual(elf.PatternFound, true);
 }
Exemplo n.º 16
0
 public void RegexShouldNotMatch4()
 {
     EventLengthFinder elf = new EventLengthFinder("Check Philippians 4:11 - 4:12");
     Assert.AreEqual(elf.PatternFound, false);
 }
Exemplo n.º 17
0
 public void RegexShouldMatch5()
 {
     EventLengthFinder elf = new EventLengthFinder("Play drums (2h 30 min) @home");
     Assert.AreEqual(elf.PatternFound, true);
 }
Exemplo n.º 18
0
 public void CalculateTime4()
 {
     EventLengthFinder elf = new EventLengthFinder("Meditate 0.5h @home");
     Assert.AreEqual(elf.TotalMinutes, 30);
 }
Exemplo n.º 19
0
 public void RegexShouldMatch6()
 {
     EventLengthFinder elf = new EventLengthFinder("Czas po polsku (5 minut) @home");
     Assert.AreEqual(elf.PatternFound, true);
 }
Exemplo n.º 20
0
 public void CalculateTime6()
 {
     EventLengthFinder elf = new EventLengthFinder("Czas po polsku (5 minut) @home");
     Assert.AreEqual(elf.TotalMinutes, 5);
 }
Exemplo n.º 21
0
 public void RegexShouldMatch8()
 {
     EventLengthFinder elf = new EventLengthFinder("Some short thing [5m]");
     Assert.AreEqual(elf.PatternFound, true);
 }
Exemplo n.º 22
0
 public void CutRegex1()
 {
     EventLengthFinder elf = new EventLengthFinder("Review english lesson @home 20m");
     Assert.AreEqual(elf.TaskSummaryWithoutPattern, "Review english lesson @home");
 }
Exemplo n.º 23
0
 public void RegexShouldNotMatch1()
 {
     EventLengthFinder elf = new EventLengthFinder("@market Buy a car");
     Assert.AreEqual(elf.PatternFound, false);
 }
Exemplo n.º 24
0
 public void CutRegex3()
 {
     EventLengthFinder elf = new EventLengthFinder("Exercise @gym 1 H");
     Assert.AreEqual(elf.TaskSummaryWithoutPattern, "Exercise @gym");
 }
Exemplo n.º 25
0
 public void RegexShouldNotMatch2()
 {
     EventLengthFinder elf = new EventLengthFinder("Buy 3 milk bottles @market");
     Assert.AreEqual(elf.PatternFound, false);
 }
Exemplo n.º 26
0
 public void CutRegex5()
 {
     EventLengthFinder elf = new EventLengthFinder("Play drums (2h 30 min) @home");
     Assert.AreEqual(elf.TaskSummaryWithoutPattern, "Play drums @home");
 }
Exemplo n.º 27
0
 /// <summary>
 /// Try to parse event's title to find indication of how long is the event. This method does not process all-day events.
 /// If such information is found and considered reliable, event's EndDate is set based on StartDate and found event duration.
 /// </summary>
 private void PredictEventDuration(bool removeEventDurationFromTitle)
 {
     foreach (VEvent evnt in calendar.VCalendar.Events)
     {
         if (evnt.IsAllDayEvent()) continue;
         EventLengthFinder elf = new EventLengthFinder(evnt.Summary.Value);
         if (elf.PatternFound)
         {
             evnt.EndDateTime.DateTimeValue = evnt.StartDateTime.DateTimeValue.AddMinutes(elf.TotalMinutes);
             if (removeEventDurationFromTitle)
             {
                 evnt.Summary.Value = elf.TaskSummaryWithoutPattern;
             }
         }
     }
 }