1 // AssemblyDelaySignAttributeTest.cs
\r
3 // Author: Vineeth N <nvineeth@yahoo.com>
\r
5 // (C) 2004 Ximian, Inc. http://www.ximian.com
\r
8 using System.Threading;
\r
9 using System.Reflection;
\r
10 using System.Reflection.Emit;
\r
11 using NUnit.Framework;
\r
13 namespace MonoTests.System.Reflection {
\r
16 /// Summary description for AssemblyDelaySignAttributeTest.
\r
19 public class AssemblyDelaySignAttributeTest:Assertion
\r
21 private AssemblyBuilder dynAssembly;
\r
22 AssemblyName dynAsmName = new AssemblyName ();
\r
23 AssemblyDelaySignAttribute attr;
\r
25 public AssemblyDelaySignAttributeTest ()
\r
27 //create a dynamic assembly with the required attribute
\r
28 //and check for the validity
\r
30 dynAsmName.Name = "TestAssembly";
\r
32 dynAssembly = Thread.GetDomain ().DefineDynamicAssembly (
\r
33 dynAsmName,AssemblyBuilderAccess.Run
\r
36 // Set the required Attribute of the assembly.
\r
37 Type attribute = typeof (AssemblyDelaySignAttribute);
\r
38 ConstructorInfo ctrInfo = attribute.GetConstructor (
\r
39 new Type [] { typeof (bool) }
\r
41 CustomAttributeBuilder attrBuilder =
\r
42 new CustomAttributeBuilder (ctrInfo, new object [1] { false });
\r
43 dynAssembly.SetCustomAttribute (attrBuilder);
\r
44 object [] attributes = dynAssembly.GetCustomAttributes (true);
\r
45 attr = attributes [0] as AssemblyDelaySignAttribute;
\r
49 public void DelaySignTest ()
\r
51 AssertEquals ("#Testing DelaySign",
\r
57 public void TypeIdTest ()
\r
59 AssertEquals ("#testing Typeid",
\r
61 typeof (AssemblyDelaySignAttribute)
\r
66 public void MatchTestForTrue ()
\r
68 AssertEquals ("#testing Match method-- for true",
\r
73 public void MatchTestForFalse ()
\r
75 AssertEquals ("#testing Match method-- for false",
\r
76 attr.Match (new AssemblyDelaySignAttribute (true)),
\r