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); }
public void RegexShouldMatch2() { EventLengthFinder elf = new EventLengthFinder("@home Read for 45 minutes"); Assert.AreEqual(elf.PatternFound, true); }
public void CalculateTime1() { EventLengthFinder elf = new EventLengthFinder("Review english lesson @home 20m"); Assert.AreEqual(elf.TotalMinutes, 20); }
public void NoTimeSpecified1() { EventLengthFinder elf = new EventLengthFinder("No time specified in this string"); int totalMinutes = elf.TotalMinutes; }
public void CutRegex8() { EventLengthFinder elf = new EventLengthFinder("Some short thing [5m]"); Assert.AreEqual(elf.TaskSummaryWithoutPattern, "Some short thing"); }
public void RegexShouldNotMatch3() { EventLengthFinder elf = new EventLengthFinder("123 45 6"); Assert.AreEqual(elf.PatternFound, false); }
public void RegexShouldMatch4() { EventLengthFinder elf = new EventLengthFinder("Meditate 0.5h @home"); Assert.AreEqual(elf.PatternFound, true); }
public void RegexShouldNotMatch4() { EventLengthFinder elf = new EventLengthFinder("Check Philippians 4:11 - 4:12"); Assert.AreEqual(elf.PatternFound, false); }
public void RegexShouldMatch5() { EventLengthFinder elf = new EventLengthFinder("Play drums (2h 30 min) @home"); Assert.AreEqual(elf.PatternFound, true); }
public void CalculateTime4() { EventLengthFinder elf = new EventLengthFinder("Meditate 0.5h @home"); Assert.AreEqual(elf.TotalMinutes, 30); }
public void RegexShouldMatch6() { EventLengthFinder elf = new EventLengthFinder("Czas po polsku (5 minut) @home"); Assert.AreEqual(elf.PatternFound, true); }
public void CalculateTime6() { EventLengthFinder elf = new EventLengthFinder("Czas po polsku (5 minut) @home"); Assert.AreEqual(elf.TotalMinutes, 5); }
public void RegexShouldMatch8() { EventLengthFinder elf = new EventLengthFinder("Some short thing [5m]"); Assert.AreEqual(elf.PatternFound, true); }
public void CutRegex1() { EventLengthFinder elf = new EventLengthFinder("Review english lesson @home 20m"); Assert.AreEqual(elf.TaskSummaryWithoutPattern, "Review english lesson @home"); }
public void RegexShouldNotMatch1() { EventLengthFinder elf = new EventLengthFinder("@market Buy a car"); Assert.AreEqual(elf.PatternFound, false); }
public void CutRegex3() { EventLengthFinder elf = new EventLengthFinder("Exercise @gym 1 H"); Assert.AreEqual(elf.TaskSummaryWithoutPattern, "Exercise @gym"); }
public void RegexShouldNotMatch2() { EventLengthFinder elf = new EventLengthFinder("Buy 3 milk bottles @market"); Assert.AreEqual(elf.PatternFound, false); }
public void CutRegex5() { EventLengthFinder elf = new EventLengthFinder("Play drums (2h 30 min) @home"); Assert.AreEqual(elf.TaskSummaryWithoutPattern, "Play drums @home"); }
/// <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; } } } }