Merge pull request #900 from Blewzman/FixAggregateExceptionGetBaseException
authorMarek Safar <marek.safar@gmail.com>
Mon, 17 Feb 2014 16:56:55 +0000 (17:56 +0100)
committerMarek Safar <marek.safar@gmail.com>
Mon, 17 Feb 2014 16:56:55 +0000 (17:56 +0100)
Add unit test for AggregateException.GetBaseException that works on .net but is broken on Mono.

mcs/class/corlib/Test/System/AggregateExceptionTests.cs

index d133a82cd86d9d3c26dab9bf6d4a4f8188c1d4d5..67cedafbbb4413b53d3f58deea763b533a9b51ea 100644 (file)
@@ -119,6 +119,14 @@ namespace MonoTests.System
                        Assert.AreEqual (expected, ae2.GetBaseException ().InnerException, "#2");
                }
 
+               [Test]
+               public void GetBaseException_stops_at_first_inner_exception_that_is_not_AggregateException()
+               {
+                       var inner = new ArgumentNullException();
+                       var outer = new InvalidOperationException("x", inner);
+                       Assert.AreEqual(outer, new AggregateException(outer).GetBaseException());
+               }
+
                static void Throws (Type t, Action action)
                {
                        Exception e = null;