1 // AssemblyDelaySignAttributeTest.cs
3 // Author: Vineeth N <nvineeth@yahoo.com>
5 // (C) 2004 Ximian, Inc. http://www.ximian.com
9 using System
.Threading
;
10 using System
.Reflection
;
11 using System
.Reflection
.Emit
;
12 using NUnit
.Framework
;
14 namespace MonoTests
.System
.Reflection
{
17 /// Summary description for AssemblyDelaySignAttributeTest.
20 public class AssemblyDelaySignAttributeTest
23 private AssemblyBuilder dynAssembly
;
24 AssemblyName dynAsmName
= new AssemblyName ();
25 AssemblyDelaySignAttribute attr
;
27 public AssemblyDelaySignAttributeTest ()
29 //create a dynamic assembly with the required attribute
30 //and check for the validity
32 dynAsmName
.Name
= "TestAssembly";
34 dynAssembly
= Thread
.GetDomain ().DefineDynamicAssembly (
35 dynAsmName
,AssemblyBuilderAccess
.Run
38 // Set the required Attribute of the assembly.
39 Type attribute
= typeof (AssemblyDelaySignAttribute
);
40 ConstructorInfo ctrInfo
= attribute
.GetConstructor (
41 new Type
[] { typeof (bool) }
43 CustomAttributeBuilder attrBuilder
=
44 new CustomAttributeBuilder (ctrInfo
, new object [1] { false }
);
45 dynAssembly
.SetCustomAttribute (attrBuilder
);
46 object [] attributes
= dynAssembly
.GetCustomAttributes (true);
47 attr
= attributes
[0] as AssemblyDelaySignAttribute
;
51 public void DelaySignTest ()
59 public void TypeIdTest ()
63 typeof (AssemblyDelaySignAttribute
)
68 public void MatchTestForTrue ()
75 public void MatchTestForFalse ()
78 attr
.Match (new AssemblyDelaySignAttribute (true)),
84 public void CtorTest ()
86 var a
= new AssemblyDelaySignAttribute (true);
87 Assert
.AreEqual (true, a
.DelaySign
);