public void BasicTestFuture(string text, int beginDay, int endDay, int month, int year)
        {
            var er = extractor.Extract(text);

            Assert.AreEqual(1, er.Count);
            var pr = parser.Parse(er[0], referenceDay);

            Assert.AreEqual(Constants.SYS_DATETIME_DATEPERIOD, pr.Type);
            var beginDate = new DateObject(year, month, beginDay);

            Assert.AreEqual(beginDate,
                            ((Tuple <DateObject, DateObject>)((DateTimeResolutionResult)pr.Value).FutureValue).Item1);
            var endDate = new DateObject(year, month, endDay);

            Assert.AreEqual(endDate,
                            ((Tuple <DateObject, DateObject>)((DateTimeResolutionResult)pr.Value).FutureValue).Item2);
        }
        public void BasicTest(string text, int start, int length)
        {
            var results = extractor.Extract(text);

            Assert.AreEqual(1, results.Count);
            Assert.AreEqual(start, results[0].Start);
            Assert.AreEqual(length, results[0].Length);
            Assert.AreEqual(Constants.SYS_DATETIME_DATEPERIOD, results[0].Type);
        }
示例#3
0
        public void BasicTest(string text, int start, int length, int expected = 1)
        {
            var results = extractor.Extract(text);

            Assert.AreEqual(expected, results.Count);

            if (expected < 1)
            {
                TestWriter.Write(TestCulture.English, extractor, text);
                return;
            }

            Assert.AreEqual(start, results[0].Start);
            Assert.AreEqual(length, results[0].Length);
            Assert.AreEqual(Constants.SYS_DATETIME_DATEPERIOD, results[0].Type);
            TestWriter.Write(TestCulture.English, extractor, text, results);
        }