lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [4/5] lucenenet git commit: Revert "Replacing [ExpectedException(T)] with Assert.Throws<T>"
Date Mon, 19 Dec 2016 03:24:06 GMT
Revert "Replacing [ExpectedException(T)] with Assert.Throws<T>"

This reverts commit 761c3343e9f99688dbb6994ad49fcf872145ab19.


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

Branch: refs/heads/master
Commit: 2005d019e1e735850bdeb0050d797793f41db5db
Parents: 10efe5b
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Mon Dec 19 10:15:24 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Mon Dec 19 10:15:24 2016 +0700

----------------------------------------------------------------------
 .../Miscellaneous/TestCapitalizationFilter.cs   | 12 +++----
 .../Miscellaneous/TestCodepointCountFilter.cs   |  4 +--
 .../Analysis/Miscellaneous/TestLengthFilter.cs  |  4 +--
 .../Miscellaneous/TestLimitTokenCountFilter.cs  |  4 +--
 .../TestLimitTokenPositionFilter.cs             |  3 +-
 .../Miscellaneous/TestTruncateTokenFilter.cs    |  3 +-
 .../Sinks/TokenRangeSinkTokenizerTest.cs        |  3 +-
 .../Analysis/Synonym/TestSolrSynonymParser.cs   | 15 ++++++---
 .../TestCompressingStoredFieldsFormat.cs        | 35 +++++++++-----------
 .../core/Support/TestLurchTable.cs              |  4 +--
 .../core/Util/TestBytesRefHash.cs               | 22 ++++++------
 src/Lucene.Net.Tests/core/Util/TestSetOnce.cs   | 12 +++----
 12 files changed, 60 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2005d019/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestCapitalizationFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestCapitalizationFilter.cs
b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestCapitalizationFilter.cs
index ffa38db..cff486e 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestCapitalizationFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestCapitalizationFilter.cs
@@ -139,24 +139,24 @@ namespace Lucene.Net.Analysis.Miscellaneous
         /// checking the validity of constructor arguments
         /// </summary>
         [Test]
+        [ExpectedException(ExpectedException = typeof(ArgumentOutOfRangeException))]
         public virtual void TestIllegalArguments()
         {
-            Assert.Throws<ArgumentOutOfRangeException>(() =>
-                new CapitalizationFilter(new MockTokenizer(new StringReader("accept only
valid arguments"), MockTokenizer.WHITESPACE, false), true, null, true, null, -1, CapitalizationFilter.DEFAULT_MAX_WORD_COUNT,
CapitalizationFilter.DEFAULT_MAX_TOKEN_LENGTH));
+            new CapitalizationFilter(new MockTokenizer(new StringReader("accept only valid
arguments"), MockTokenizer.WHITESPACE, false), true, null, true, null, -1, CapitalizationFilter.DEFAULT_MAX_WORD_COUNT,
CapitalizationFilter.DEFAULT_MAX_TOKEN_LENGTH);
         }
 
         [Test]
+        [ExpectedException(ExpectedException = typeof(ArgumentOutOfRangeException))]
         public virtual void TestIllegalArguments1()
         {
-            Assert.Throws<ArgumentOutOfRangeException>(() =>
-                new CapitalizationFilter(new MockTokenizer(new StringReader("accept only
valid arguments"), MockTokenizer.WHITESPACE, false), true, null, true, null, 0, -10, CapitalizationFilter.DEFAULT_MAX_TOKEN_LENGTH));
+            new CapitalizationFilter(new MockTokenizer(new StringReader("accept only valid
arguments"), MockTokenizer.WHITESPACE, false), true, null, true, null, 0, -10, CapitalizationFilter.DEFAULT_MAX_TOKEN_LENGTH);
         }
 
         [Test]
+        [ExpectedException(ExpectedException = typeof(ArgumentOutOfRangeException))]
         public virtual void TestIllegalArguments2()
         {
-            Assert.Throws<ArgumentOutOfRangeException>(() =>
-                new CapitalizationFilter(new MockTokenizer(new StringReader("accept only
valid arguments"), MockTokenizer.WHITESPACE, false), true, null, true, null, 0, CapitalizationFilter.DEFAULT_MAX_WORD_COUNT,
-50));
+            new CapitalizationFilter(new MockTokenizer(new StringReader("accept only valid
arguments"), MockTokenizer.WHITESPACE, false), true, null, true, null, 0, CapitalizationFilter.DEFAULT_MAX_WORD_COUNT,
-50);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2005d019/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestCodepointCountFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestCodepointCountFilter.cs
b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestCodepointCountFilter.cs
index 78c9f67..b690ae9 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestCodepointCountFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestCodepointCountFilter.cs
@@ -86,10 +86,10 @@ namespace Lucene.Net.Analysis.Miscellaneous
         /// checking the validity of constructor arguments
         /// </summary>
         [Test]
+        [ExpectedException(ExpectedException = typeof(ArgumentOutOfRangeException))]
         public virtual void TestIllegalArguments()
         {
-            Assert.Throws<ArgumentOutOfRangeException>(() =>
-                new CodepointCountFilter(TEST_VERSION_CURRENT, new MockTokenizer(new StringReader("accept
only valid arguments"), MockTokenizer.WHITESPACE, false), 4, 1));
+            new CodepointCountFilter(TEST_VERSION_CURRENT, new MockTokenizer(new StringReader("accept
only valid arguments"), MockTokenizer.WHITESPACE, false), 4, 1);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2005d019/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLengthFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLengthFilter.cs
b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLengthFilter.cs
index 47b9614..43eb450 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLengthFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLengthFilter.cs
@@ -71,10 +71,10 @@ namespace Lucene.Net.Analysis.Miscellaneous
         /// checking the validity of constructor arguments
         /// </summary>
         [Test]
+        [ExpectedException(ExpectedException = typeof(ArgumentOutOfRangeException))]
         public virtual void TestIllegalArguments()
         {
-            Assert.Throws<ArgumentOutOfRangeException>(() =>
-                new LengthFilter(TEST_VERSION_CURRENT, new MockTokenizer(new StringReader("accept
only valid arguments")), -4, -1));
+            new LengthFilter(TEST_VERSION_CURRENT, new MockTokenizer(new StringReader("accept
only valid arguments")), -4, -1);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2005d019/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenCountFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenCountFilter.cs
b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenCountFilter.cs
index e1d12e0..f0e9e4b 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenCountFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenCountFilter.cs
@@ -37,10 +37,10 @@ namespace Lucene.Net.Analysis.Miscellaneous
         }
 
         [Test]
+        [ExpectedException(ExpectedException = typeof(ArgumentOutOfRangeException))]
         public virtual void TestIllegalArguments()
         {
-            Assert.Throws<ArgumentOutOfRangeException>(() =>
-                new LimitTokenCountFilter(new MockTokenizer(new StringReader("A1 B2 C3 D4
E5 F6"), MockTokenizer.WHITESPACE, false), -1));
+            new LimitTokenCountFilter(new MockTokenizer(new StringReader("A1 B2 C3 D4 E5
F6"), MockTokenizer.WHITESPACE, false), -1);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2005d019/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenPositionFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenPositionFilter.cs
b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenPositionFilter.cs
index 933c744..c32b5f9 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenPositionFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenPositionFilter.cs
@@ -92,9 +92,10 @@ namespace Lucene.Net.Analysis.Miscellaneous
         }
 
         [Test]
+        [ExpectedException(ExpectedException = typeof(ArgumentException))]
         public virtual void TestIllegalArguments()
         {
-            Assert.Throws<ArgumentException>(() => new LimitTokenPositionFilter(new
MockTokenizer(new StringReader("one two three four five")), 0));
+            new LimitTokenPositionFilter(new MockTokenizer(new StringReader("one two three
four five")), 0);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2005d019/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestTruncateTokenFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestTruncateTokenFilter.cs
b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestTruncateTokenFilter.cs
index 26ea658..dcd886d 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestTruncateTokenFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestTruncateTokenFilter.cs
@@ -36,9 +36,10 @@ namespace Lucene.Net.Analysis.Miscellaneous
         }
 
         [Test]
+        [ExpectedException(ExpectedException = typeof(ArgumentOutOfRangeException))]
         public virtual void TestNonPositiveLength()
         {
-            Assert.Throws<ArgumentOutOfRangeException>(() =>  new TruncateTokenFilter(new
MockTokenizer(new StringReader("length must be a positive number")), -48));
+            new TruncateTokenFilter(new MockTokenizer(new StringReader("length must be a
positive number")), -48);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2005d019/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TokenRangeSinkTokenizerTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TokenRangeSinkTokenizerTest.cs
b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TokenRangeSinkTokenizerTest.cs
index 80444c7..5ec9ade 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TokenRangeSinkTokenizerTest.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TokenRangeSinkTokenizerTest.cs
@@ -51,9 +51,10 @@ namespace Lucene.Net.Analysis.Sinks
         }
 
         [Test]
+        [ExpectedException(ExpectedException = typeof(ArgumentOutOfRangeException))]
         public virtual void TestIllegalArguments()
         {
-            Assert.Throws<ArgumentOutOfRangeException>(() => new TokenRangeSinkFilter(4,
2));
+            new TokenRangeSinkFilter(4, 2);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2005d019/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSolrSynonymParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSolrSynonymParser.cs
b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSolrSynonymParser.cs
index b04f6cc..983c75c 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSolrSynonymParser.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSolrSynonymParser.cs
@@ -73,51 +73,56 @@ namespace Lucene.Net.Analysis.Synonym
         /// <summary>
         /// parse a syn file with bad syntax </summary>
         [Test]
+        [ExpectedException(ExpectedException = typeof(Exception))]
         public virtual void TestInvalidDoubleMap()
         {
             string testFile = "a => b => c";
             SolrSynonymParser parser = new SolrSynonymParser(true, true, new MockAnalyzer(Random()));
-            Assert.Throws<Exception>(() => parser.Parse(new StringReader(testFile)));
+            parser.Parse(new StringReader(testFile));
         }
 
         /// <summary>
         /// parse a syn file with bad syntax </summary>
         [Test]
+        [ExpectedException(ExpectedException = typeof(Exception))]
         public virtual void TestInvalidAnalyzesToNothingOutput()
         {
             string testFile = "a => 1";
             SolrSynonymParser parser = new SolrSynonymParser(true, true, new MockAnalyzer(Random(),
MockTokenizer.SIMPLE, false));
-            Assert.Throws<Exception>(() => parser.Parse(new StringReader(testFile)));
+            parser.Parse(new StringReader(testFile));
         }
 
         /// <summary>
         /// parse a syn file with bad syntax </summary>
         [Test]
+        [ExpectedException(ExpectedException = typeof(Exception))]
         public virtual void TestInvalidAnalyzesToNothingInput()
         {
             string testFile = "1 => a";
             SolrSynonymParser parser = new SolrSynonymParser(true, true, new MockAnalyzer(Random(),
MockTokenizer.SIMPLE, false));
-            Assert.Throws<Exception>(() => parser.Parse(new StringReader(testFile)));
+            parser.Parse(new StringReader(testFile));
         }
 
         /// <summary>
         /// parse a syn file with bad syntax </summary>
         [Test]
+        [ExpectedException(ExpectedException = typeof(Exception))]
         public virtual void TestInvalidPositionsInput()
         {
             string testFile = "testola => the test";
             SolrSynonymParser parser = new SolrSynonymParser(true, true, new EnglishAnalyzer(TEST_VERSION_CURRENT));
-            Assert.Throws<Exception>(() => parser.Parse(new StringReader(testFile)));
+            parser.Parse(new StringReader(testFile));
         }
 
         /// <summary>
         /// parse a syn file with bad syntax </summary>
         [Test]
+        [ExpectedException(ExpectedException = typeof(Exception))]
         public virtual void TestInvalidPositionsOutput()
         {
             string testFile = "the test => testola";
             SolrSynonymParser parser = new SolrSynonymParser(true, true, new EnglishAnalyzer(TEST_VERSION_CURRENT));
-            Assert.Throws<Exception>(() => parser.Parse(new StringReader(testFile)));
+            parser.Parse(new StringReader(testFile));
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2005d019/src/Lucene.Net.Tests/core/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs
b/src/Lucene.Net.Tests/core/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs
index e902cb1..998b942 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs
@@ -1,5 +1,4 @@
 using Lucene.Net.Documents;
-using System;
 using Field = Lucene.Net.Documents.Field;
 
 namespace Lucene.Net.Codecs.Compressing
@@ -46,6 +45,7 @@ namespace Lucene.Net.Codecs.Compressing
         }
 
         [Test]
+        [ExpectedException("System.ArgumentException")]
         public virtual void TestDeletePartiallyWrittenFilesIfAbort()
         {
             Directory dir = NewDirectory();
@@ -68,29 +68,26 @@ namespace Lucene.Net.Codecs.Compressing
             fieldType.Stored = true;
             invalidDoc.Add(new FieldAnonymousInnerClassHelper(this, fieldType));
 
-            Assert.Throws<ArgumentException>(() =>
+            try
             {
-                try
-                {
-                    iw.AddDocument(invalidDoc);
-                    iw.Commit();
-                }
-                finally
+                iw.AddDocument(invalidDoc);
+                iw.Commit();
+            }
+            finally
+            {
+                int counter = 0;
+                foreach (string fileName in dir.ListAll())
                 {
-                    int counter = 0;
-                    foreach (string fileName in dir.ListAll())
+                    if (fileName.EndsWith(".fdt") || fileName.EndsWith(".fdx"))
                     {
-                        if (fileName.EndsWith(".fdt") || fileName.EndsWith(".fdx"))
-                        {
-                            counter++;
-                        }
+                        counter++;
                     }
-                    // Only one .fdt and one .fdx files must have been found
-                    Assert.AreEqual(2, counter);
-                    iw.Dispose();
-                    dir.Dispose();
                 }
-            });
+                // Only one .fdt and one .fdx files must have been found
+                Assert.AreEqual(2, counter);
+                iw.Dispose();
+                dir.Dispose();
+            }
         }
 
         private class FieldAnonymousInnerClassHelper : Field

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2005d019/src/Lucene.Net.Tests/core/Support/TestLurchTable.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Support/TestLurchTable.cs b/src/Lucene.Net.Tests/core/Support/TestLurchTable.cs
index 778b419..264e95c 100644
--- a/src/Lucene.Net.Tests/core/Support/TestLurchTable.cs
+++ b/src/Lucene.Net.Tests/core/Support/TestLurchTable.cs
@@ -504,7 +504,7 @@ namespace Lucene.Net.Support
             VerifyCollection(EqualityComparer<string>.Default, values.AsReadOnly(),
dict.Values);
         }
 
-        [Test]
+        [Test, ExpectedException(typeof(ObjectDisposedException))]
         public void TestDisposed()
         {
             IDictionary<int, string> test = new LurchTableTest<int, string>();
@@ -513,7 +513,7 @@ namespace Lucene.Net.Support
             {
                 disposable.Dispose();
             }
-            Assert.Throws<ObjectDisposedException>(() => test.Add(1, ""));
+            test.Add(1, "");
         }
 
         class KeyValueEquality<TKey, TValue> : IEqualityComparer<KeyValuePair<TKey,
TValue>>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2005d019/src/Lucene.Net.Tests/core/Util/TestBytesRefHash.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestBytesRefHash.cs b/src/Lucene.Net.Tests/core/Util/TestBytesRefHash.cs
index a6ecf0e..c439dfd 100644
--- a/src/Lucene.Net.Tests/core/Util/TestBytesRefHash.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestBytesRefHash.cs
@@ -323,6 +323,7 @@ namespace Lucene.Net.Util
         }
 
         [Test]
+        [ExpectedException(typeof(MaxBytesLengthExceededException))]
         public virtual void TestLargeValue()
         {
             int[] sizes = { Random().Next(5), ByteBlockPool.BYTE_BLOCK_SIZE - 33 + Random().Next(31),
ByteBlockPool.BYTE_BLOCK_SIZE - 1 + Random().Next(37) };
@@ -332,21 +333,18 @@ namespace Lucene.Net.Util
                 @ref.Bytes = new byte[sizes[i]];
                 @ref.Offset = 0;
                 @ref.Length = sizes[i];
-                Assert.Throws<MaxBytesLengthExceededException>(() =>
+                try
                 {
-                    try
-                    {
-                        Assert.AreEqual(i, Hash.Add(@ref));
-                    }
-                    catch (MaxBytesLengthExceededException e)
+                    Assert.AreEqual(i, Hash.Add(@ref));
+                }
+                catch (MaxBytesLengthExceededException e)
+                {
+                    if (i < sizes.Length - 1)
                     {
-                        if (i < sizes.Length - 1)
-                        {
-                            Assert.Fail("unexpected exception at size: " + sizes[i]);
-                        }
-                        throw e;
+                        Assert.Fail("unexpected exception at size: " + sizes[i]);
                     }
-                });
+                    throw e;
+                }
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2005d019/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 4bd23bf..af0cd37 100644
--- a/src/Lucene.Net.Tests/core/Util/TestSetOnce.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestSetOnce.cs
@@ -65,26 +65,22 @@ namespace Lucene.Net.Util
         }
 
         [Test]
+        [ExpectedException(typeof(SetOnce<int?>.AlreadySetException))]
         public virtual void TestSettingCtor()
         {
             SetOnce<int?> set = new SetOnce<int?>(new int?(5));
             Assert.AreEqual(5, (int)set.Get());
-            Assert.Throws<SetOnce<int?>.AlreadySetException>(() =>
-            {
-                set.Set(new int?(7));
-            });
+            set.Set(new int?(7));
         }
 
         [Test]
+        [ExpectedException(typeof(SetOnce<int?>.AlreadySetException))]
         public virtual void TestSetOnce_mem()
         {
             SetOnce<int?> set = new SetOnce<int?>();
             set.Set(new int?(5));
             Assert.AreEqual(5, (int)set.Get());
-            Assert.Throws<SetOnce<int?>.AlreadySetException>(() =>
-            {
-                set.Set(new int?(7));
-            });
+            set.Set(new int?(7));
         }
 
         [Test]


Mime
View raw message