public virtual void TestLooseDateFormat() { DateRecognizerSinkFilter sinkFilter = new DateRecognizerSinkFilter(CultureInfo.InvariantCulture); string test = "The quick red fox jumped over the lazy brown dogs on 7/11/2006 The dogs finally reacted on 7/2/2006"; TeeSinkTokenFilter tee = new TeeSinkTokenFilter(new MockTokenizer(new StringReader(test), MockTokenizer.WHITESPACE, false)); TeeSinkTokenFilter.SinkTokenStream sink = tee.NewSinkTokenStream(sinkFilter); int count = 0; tee.Reset(); while (tee.IncrementToken()) { count++; } assertTrue(count + " does not equal: " + 18, count == 18); int sinkCount = 0; sink.Reset(); while (sink.IncrementToken()) { sinkCount++; } assertTrue("sink Size: " + sinkCount + " is not: " + 2, sinkCount == 2); }
public void Test() { DateRecognizerSinkFilter sinkFilter = new DateRecognizerSinkFilter(System.Globalization.CultureInfo.CurrentCulture); String test = "The quick red fox jumped over the lazy brown dogs on 7/11/2006 The dogs finally reacted on 7/12/2006"; TeeSinkTokenFilter tee = new TeeSinkTokenFilter(new WhitespaceTokenizer(new StringReader(test))); TeeSinkTokenFilter.SinkTokenStream sink = tee.NewSinkTokenStream(sinkFilter); int count = 0; tee.Reset(); while (tee.IncrementToken()) { count++; } Assert.True(count == 18, count + " does not equal: " + 18); int sinkCount = 0; sink.Reset(); while (sink.IncrementToken()) { sinkCount++; } Assert.True(sinkCount == 2, "sink Size: " + sinkCount + " is not: " + 2); }