Merge pull request #901 from Blewzman/FixAggregateExceptionGetBaseException
[mono.git] / mcs / class / corlib / Test / System.Reflection / ParameterInfoTest.cs
index ff1d915632d1755ab027e9d4de6eeec46852eec0..b22f46f36507cf03144467ebacdb9adedc85f3be 100644 (file)
@@ -98,6 +98,15 @@ namespace MonoTests.System.Reflection
                        Assert.AreEqual (ParamEnum.Foo, info [5].DefaultValue, "#2");
                }
 
+#if NET_4_5
+               [Test]
+               public void HasDefaultValueEnum () {
+                       ParameterInfo[] info = typeof (ParameterInfoTest).GetMethod ("paramMethod").GetParameters ();
+
+                       Assert.IsTrue (info [5].HasDefaultValue);
+               }
+#endif
+
                public static void Sample2 ([DecimalConstantAttribute(2,2,2,2,2)] decimal a, [DateTimeConstantAttribute(123456)] DateTime b) {}
 
                [Test]
@@ -117,7 +126,19 @@ namespace MonoTests.System.Reflection
                        Assert.AreEqual (pi [1].DefaultValue.GetType (), typeof (Missing), "#2");
                }
 
-               public void Sample (int a, [Optional] int b)
+#if NET_4_5
+               [Test]
+               public void TestHasDefaultValues ()
+               {
+                       ParameterInfo [] pi = typeof (ParameterInfoTest).GetMethod ("Sample").GetParameters ();
+
+                       Assert.IsFalse (pi [0].HasDefaultValue, "#1");
+                       Assert.IsFalse (pi [1].HasDefaultValue, "#2");
+                       Assert.IsTrue (pi [2].HasDefaultValue, "#3");
+               }
+#endif
+
+               public void Sample (int a, [Optional] int b, object c = null)
                {
                }
 
@@ -235,6 +256,14 @@ namespace MonoTests.System.Reflection
                        Assert.AreEqual (decimal.MaxValue, info [0].DefaultValue);
                }
 
+#if NET_4_5
+               [Test]
+               public void HasDefaultValueDecimal () {
+                       var info = typeof (ParameterInfoTest).GetMethod ("TestC").GetParameters ();
+                       Assert.IsTrue (info [0].HasDefaultValue);
+               }
+#endif
+
                class MyParameterInfo2 : ParameterInfo
                {
                        public ParameterAttributes MyAttrsImpl;