1 // AssemblyCopyrightAttributeTest.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 /// Test Fixture for AssemblyCopyrightAttribute
20 public class AssemblyCopyrightAttributeTest
22 private AssemblyBuilder dynAssembly
;
23 AssemblyName dynAsmName
= new AssemblyName ();
24 AssemblyCopyrightAttribute attr
;
26 public AssemblyCopyrightAttributeTest ()
28 //create a dynamic assembly with the required attribute
29 //and check for the validity
31 dynAsmName
.Name
= "TestAssembly";
33 dynAssembly
= Thread
.GetDomain().DefineDynamicAssembly (
34 dynAsmName
,AssemblyBuilderAccess
.Run
37 // Set the required Attribute of the assembly.
38 Type attribute
= typeof (AssemblyCopyrightAttribute
);
39 ConstructorInfo ctrInfo
= attribute
.GetConstructor (
40 new Type
[]{ typeof (string) }
42 CustomAttributeBuilder attrBuilder
=
43 new CustomAttributeBuilder (ctrInfo
, new object [1] {"Ximian"}
);
44 dynAssembly
.SetCustomAttribute(attrBuilder
);
45 object [] attributes
= dynAssembly
.GetCustomAttributes (true);
46 attr
= attributes
[0] as AssemblyCopyrightAttribute
;
50 public void CopyrightTest ()
58 public void TypeIdTest ()
62 typeof (AssemblyCopyrightAttribute
)
67 public void MatchTestForTrue ()
75 public void MatchTestForFalse ()
78 attr
.Match (new AssemblyCopyrightAttribute ("imian")),