lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [lucenenet] 01/13: Lucene.Net.TestFramework.Analysis.ICheckClearAttributesAttribute: Converted property AndResetClearCalled back to a method GetAndResetClearCalled(), as it has a side-effect, which makes it a poor candidate for a property.
Date Sat, 26 Oct 2019 18:51:56 GMT
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 2e2710edf5777e8338bed16862c0cf862540a6f1
Author: Shad Storhaug <shad@shadstorhaug.com>
AuthorDate: Sat Oct 26 23:20:12 2019 +0700

    Lucene.Net.TestFramework.Analysis.ICheckClearAttributesAttribute: Converted property AndResetClearCalled
back to a method GetAndResetClearCalled(), as it has a side-effect, which makes it a poor
candidate for a property.
---
 .../Analysis/BaseTokenStreamTestCase.cs               | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
index 7624056..483036d 100644
--- a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
@@ -53,7 +53,7 @@ namespace Lucene.Net.Analysis
     /// </summary>
     public interface ICheckClearAttributesAttribute : IAttribute
     {
-        bool AndResetClearCalled { get; }
+        bool GetAndResetClearCalled();
     }
 
     /// <summary>
@@ -64,14 +64,11 @@ namespace Lucene.Net.Analysis
     {
         private bool clearCalled = false;
 
-        public bool AndResetClearCalled
+        public bool GetAndResetClearCalled()
         {
-            get
-            {
-                bool old = clearCalled;
-                clearCalled = false;
-                return old;
-            }
+            bool old = clearCalled;
+            clearCalled = false;
+            return old;
         }
 
         public override void Clear()
@@ -228,7 +225,7 @@ namespace Lucene.Net.Analysis
                         keywordAtt.IsKeyword = (i & 1) == 0;
                     }
 
-                    bool reset = checkClearAtt.AndResetClearCalled; // reset it, because
we called clearAttribute() before
+                    bool reset = checkClearAtt.GetAndResetClearCalled(); // reset it, because
we called clearAttribute() before
                     Assert.IsTrue(ts.IncrementToken(), "token " + i + " does not exist");
                     Assert.IsTrue(reset, "ClearAttributes() was not called correctly in TokenStream
chain");
 
@@ -362,10 +359,10 @@ namespace Lucene.Net.Analysis
                     posLengthAtt.PositionLength = 45987653;
                 }
 
-                var reset_ = checkClearAtt.AndResetClearCalled; // reset it, because we called
clearAttribute() before
+                var reset_ = checkClearAtt.GetAndResetClearCalled(); // reset it, because
we called clearAttribute() before
 
                 ts.End();
-                Assert.IsTrue(checkClearAtt.AndResetClearCalled, "super.End()/ClearAttributes()
was not called correctly in End()");
+                Assert.IsTrue(checkClearAtt.GetAndResetClearCalled(), "base.End()/ClearAttributes()
was not called correctly in End()");
 
                 if (finalOffset != null)
                 {


Mime
View raw message