Check for null and valuetypes.
[mono.git] / mcs / class / corlib / Test / System.Reflection.Emit / CustomAttributeBuilderTest.cs
index 175e0bdc3b562d4fec9832135da5a011a5ace3f0..c104f4eb8eedb787627d74dce701d8af5326196b 100644 (file)
@@ -645,6 +645,39 @@ namespace MonoTests.System.Reflection.Emit
                                                 typeof (C).GetConstructors ()[0],
                                                 new object[] { new C (1) });
                }
+
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void ValueTypeParam_Null ()
+               {
+               ConstructorInfo classCtorInfo = 
+                   typeof (CattrD).GetConstructors ()[0];
+       
+               CustomAttributeBuilder typeCABuilder = new CustomAttributeBuilder (
+                   classCtorInfo, new object [] { null });
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void ValueTypeArrayParam_Null ()
+               {
+               ConstructorInfo classCtorInfo = 
+                   typeof (CattrE).GetConstructors ()[0];
+       
+               CustomAttributeBuilder typeCABuilder = new CustomAttributeBuilder (
+                   classCtorInfo, new object [] { new object[] { null } });
+               }
+               
+               public class CattrD : Attribute
+               {
+                   public CattrD (bool b) {}
+               }
+               
+               public class CattrE : Attribute
+               {
+                   public CattrE (bool[] b) {}
+               }
        }
 }