Lucene.Net.Tests.Util.TestFilterIterator.TestUnmodifiable(): Removed because by definition an enumerator is not modifiable in .NET. Changed FilterIterator to support .Reset() by calling the underlying implementation.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/5dd512bd Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/5dd512bd Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/5dd512bd Branch: refs/heads/api-work Commit: 5dd512bd5154cd41fbc62a72c4bd1f5b1d76e200 Parents: 39e3fa2 Author: Shad Storhaug <[email protected]> Authored: Sun Mar 5 03:57:31 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Sun Mar 5 17:08:46 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net.Core/Util/FilterIterator.cs | 3 +- src/Lucene.Net.Tests/Util/TestFilterIterator.cs | 34 +++++++++++--------- 2 files changed, 20 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5dd512bd/src/Lucene.Net.Core/Util/FilterIterator.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/FilterIterator.cs b/src/Lucene.Net.Core/Util/FilterIterator.cs index 87cced1..f4c8743 100644 --- a/src/Lucene.Net.Core/Util/FilterIterator.cs +++ b/src/Lucene.Net.Core/Util/FilterIterator.cs @@ -60,9 +60,10 @@ namespace Lucene.Net.Util return true; } + // LUCENENET specific - seems logical to call reset on the underlying implementation public void Reset() { - throw new NotSupportedException(); + iter.Reset(); } private bool SetNext() http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5dd512bd/src/Lucene.Net.Tests/Util/TestFilterIterator.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Util/TestFilterIterator.cs b/src/Lucene.Net.Tests/Util/TestFilterIterator.cs index 5d1616c..19a6f1e 100644 --- a/src/Lucene.Net.Tests/Util/TestFilterIterator.cs +++ b/src/Lucene.Net.Tests/Util/TestFilterIterator.cs @@ -216,22 +216,24 @@ namespace Lucene.Net.Util } } - [Test] - public virtual void TestUnmodifiable() - { - IEnumerator<string> it = new FilterIteratorAnonymousInnerClassHelper8(this, Set.GetEnumerator()); - it.MoveNext(); - Assert.AreEqual("a", it.Current); - try - { - it.Reset(); - Assert.Fail("Should throw UnsupportedOperationException"); - } - catch (NotImplementedException) - { - // pass - } - } + //// LUCENENET specific: .NET doesn't support Remove(), so this test doesn't apply + //[Test] + //public virtual void TestUnmodifiable() + //{ + // IEnumerator<string> it = new FilterIteratorAnonymousInnerClassHelper8(this, Set.GetEnumerator()); + // it.MoveNext(); + // Assert.AreEqual("a", it.Current); + // try + // { + + // it.Remove(); + // Assert.Fail("Should throw UnsupportedOperationException"); + // } + // catch (NotSupportedException) + // { + // // pass + // } + //} private class FilterIteratorAnonymousInnerClassHelper8 : FilterIterator<string> {
