lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [02/21] git commit: Fixed TestSetOnce tests
Date Fri, 19 Sep 2014 14:19:35 GMT
Fixed TestSetOnce tests

These tests expect exceptions to be thrown, so I added that requirement
as a test attribute.


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

Branch: refs/heads/master
Commit: 95cd6c2645293ac3a9c209c86d156713bffd2601
Parents: b764030
Author: Prad Nelluru <prnell@microsoft.com>
Authored: Tue Sep 16 11:09:10 2014 -0700
Committer: Prad Nelluru <prnell@microsoft.com>
Committed: Tue Sep 16 11:09:10 2014 -0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/core/Util/TestSetOnce.cs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/95cd6c26/src/Lucene.Net.Tests/core/Util/TestSetOnce.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestSetOnce.cs b/src/Lucene.Net.Tests/core/Util/TestSetOnce.cs
index 8cdd7cf..2a97413 100644
--- a/src/Lucene.Net.Tests/core/Util/TestSetOnce.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestSetOnce.cs
@@ -64,6 +64,7 @@ namespace Lucene.Net.Util
         }
 
         [Test]
+        [ExpectedException(typeof(SetOnce<int?>.AlreadySetException))]
         public virtual void TestSettingCtor()
         {
             SetOnce<int?> set = new SetOnce<int?>(new int?(5));
@@ -72,6 +73,7 @@ namespace Lucene.Net.Util
         }
 
         [Test]
+        [ExpectedException(typeof(SetOnce<int?>.AlreadySetException))]
         public virtual void TestSetOnce_mem()
         {
             SetOnce<int?> set = new SetOnce<int?>();
@@ -85,9 +87,10 @@ namespace Lucene.Net.Util
         {
             SetOnce<int?> set = new SetOnce<int?>();
             SetOnceThread[] threads = new SetOnceThread[10];
+            Random random = Random();
             for (int i = 0; i < threads.Length; i++)
             {
-                threads[i] = new SetOnceThread(Random());
+                threads[i] = new SetOnceThread(random);
                 threads[i].Name = "t-" + (i + 1);
                 threads[i].Set = set;
             }


Mime
View raw message