You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2016/09/01 14:36:26 UTC

[06/22] lucenenet git commit: Ported Analysis.Miscellaneous.TestSingleTokenTokenFilter

Ported Analysis.Miscellaneous.TestSingleTokenTokenFilter


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/65f1c5f0
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/65f1c5f0
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/65f1c5f0

Branch: refs/heads/analysis-work
Commit: 65f1c5f0d2571e687073848b0ec14b98e8a603d8
Parents: 0549bf1
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Aug 24 19:34:00 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Wed Aug 24 19:34:00 2016 +0700

----------------------------------------------------------------------
 .../Miscellaneous/TestSingleTokenTokenFilter.cs | 65 ++++++++++----------
 .../Lucene.Net.Tests.Analysis.Common.csproj     |  1 +
 2 files changed, 32 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/65f1c5f0/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestSingleTokenTokenFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestSingleTokenTokenFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestSingleTokenTokenFilter.cs
index 7781dc4..a6ee91a 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestSingleTokenTokenFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestSingleTokenTokenFilter.cs
@@ -1,7 +1,10 @@
-\ufeffnamespace org.apache.lucene.analysis.miscellaneous
-{
+\ufeffusing Lucene.Net.Analysis.Tokenattributes;
+using Lucene.Net.Util;
+using NUnit.Framework;
 
-	/*
+namespace Lucene.Net.Analysis.Miscellaneous
+{
+    /*
 	 * Licensed to the Apache Software Foundation (ASF) under one or more
 	 * contributor license agreements.  See the NOTICE file distributed with
 	 * this work for additional information regarding copyright ownership.
@@ -18,35 +21,29 @@
 	 * limitations under the License.
 	 */
 
-	using LuceneTestCase = org.apache.lucene.util.LuceneTestCase;
-	using AttributeImpl = org.apache.lucene.util.AttributeImpl;
-	using CharTermAttribute = org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
-
-	public class TestSingleTokenTokenFilter : LuceneTestCase
-	{
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public void test() throws java.io.IOException
-	  public virtual void test()
-	  {
-		Token token = new Token();
-		SingleTokenTokenStream ts = new SingleTokenTokenStream(token);
-		AttributeImpl tokenAtt = (AttributeImpl) ts.addAttribute(typeof(CharTermAttribute));
-		assertTrue(tokenAtt is Token);
-		ts.reset();
-
-		assertTrue(ts.incrementToken());
-		assertEquals(token, tokenAtt);
-		assertFalse(ts.incrementToken());
-
-		token = new Token("hallo", 10, 20, "someType");
-		ts.Token = token;
-		ts.reset();
-
-		assertTrue(ts.incrementToken());
-		assertEquals(token, tokenAtt);
-		assertFalse(ts.incrementToken());
-	  }
-	}
-
+    public class TestSingleTokenTokenFilter : LuceneTestCase
+    {
+
+        [Test]
+        public virtual void Test()
+        {
+            Token token = new Token();
+            SingleTokenTokenStream ts = new SingleTokenTokenStream(token);
+            var tokenAtt = ts.AddAttribute<ICharTermAttribute>();
+            assertTrue(tokenAtt is Token);
+            ts.Reset();
+
+            assertTrue(ts.IncrementToken());
+            assertEquals(token, tokenAtt);
+            assertFalse(ts.IncrementToken());
+
+            token = new Token("hallo", 10, 20, "someType");
+            ts.Token = token;
+            ts.Reset();
+
+            assertTrue(ts.IncrementToken());
+            assertEquals(token, tokenAtt);
+            assertFalse(ts.IncrementToken());
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/65f1c5f0/src/Lucene.Net.Tests.Analysis.Common/Lucene.Net.Tests.Analysis.Common.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Lucene.Net.Tests.Analysis.Common.csproj b/src/Lucene.Net.Tests.Analysis.Common/Lucene.Net.Tests.Analysis.Common.csproj
index 048bac7..3ed4a9d 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Lucene.Net.Tests.Analysis.Common.csproj
+++ b/src/Lucene.Net.Tests.Analysis.Common/Lucene.Net.Tests.Analysis.Common.csproj
@@ -220,6 +220,7 @@
     <Compile Include="Analysis\Miscellaneous\TestScandinavianFoldingFilterFactory.cs" />
     <Compile Include="Analysis\Miscellaneous\TestScandinavianNormalizationFilter.cs" />
     <Compile Include="Analysis\Miscellaneous\TestScandinavianNormalizationFilterFactory.cs" />
+    <Compile Include="Analysis\Miscellaneous\TestSingleTokenTokenFilter.cs" />
     <Compile Include="Analysis\Miscellaneous\TestStemmerOverrideFilter.cs" />
     <Compile Include="Analysis\Miscellaneous\TestStemmerOverrideFilterFactory.cs" />
     <Compile Include="Analysis\Miscellaneous\TestTrimFilter.cs" />