Ejemplo n.º 1
0
        private IEnumerable <TemporalComponent> GetComponentsFromText(string text)
        {
            var components = new List <TemporalComponent>();

            var dateComponents = DateComponent.GetComponentsFromText(text);

            components.AddRange(dateComponents);

            var timeComponents = TimeComponent.GetComponentsFromText(text);

            components.AddRange(timeComponents);

            var sequenceComponents = SequenceComponent.GetComponentsFromText(text);

            components.AddRange(sequenceComponents);

            var fuzzyComponents = FuzzyComponent.GetComponentsFromText(text);

            components.AddRange(fuzzyComponents);

            var durationComponents = DurationComponent.GetComponentsFromText(text);

            components.AddRange(durationComponents);

            var relativeComponents = RelativeDateTimeComponent.GetComponentsFromText(text);

            components.AddRange(relativeComponents);

            return(components);
        }
Ejemplo n.º 2
0
        private void AssertValidFuzzyComponent(ITimePeriod expected, string input, DateTime baseDate)
        {
            var components = FuzzyComponent.GetComponentsFromText(input);

            Assert.IsTrue(components.Any());
            var componentPeriod = components.FirstOrDefault().GetTimePeriod(baseDate);

            Assert.IsNotNull(componentPeriod);
            Assert.AreEqual(expected.Start, componentPeriod.Start);
            Assert.AreEqual(expected.End, componentPeriod.End);
        }