1 // AssemblyCultureAttributeTest.cs
\r
3 // Author: Vineeth N <nvineeth@yahoo.com>
\r
5 // (C) 2004 Ximian, Inc. http://www.ximian.com
\r
9 using System.Threading;
\r
10 using System.Reflection;
\r
11 using System.Reflection.Emit;
\r
12 using NUnit.Framework;
\r
14 namespace MonoTests.System.Reflection {
\r
17 /// Test Fixture for AssemblyCultureAttribute
\r
20 public class AssemblyCultureAttributeTest : Assertion
\r
22 private AssemblyBuilder dynAssembly;
\r
23 AssemblyName dynAsmName = new AssemblyName ();
\r
24 AssemblyCultureAttribute attr;
\r
26 public AssemblyCultureAttributeTest ()
\r
28 //create a dynamic assembly with the required attribute
\r
29 //and check for the validity
\r
31 dynAsmName.Name = "TestAssembly";
\r
33 dynAssembly = Thread.GetDomain ().DefineDynamicAssembly (
\r
34 dynAsmName,AssemblyBuilderAccess.Run
\r
37 // Set the required Attribute of the assembly.
\r
38 Type attribute = typeof (AssemblyCultureAttribute);
\r
39 ConstructorInfo ctrInfo = attribute.GetConstructor (
\r
40 new Type [] { typeof (string) }
\r
42 CustomAttributeBuilder attrBuilder =
\r
43 new CustomAttributeBuilder (ctrInfo, new object [1] { "India" });
\r
44 dynAssembly.SetCustomAttribute (attrBuilder);
\r
45 object [] attributes = dynAssembly.GetCustomAttributes(true);
\r
46 attr = attributes [0] as AssemblyCultureAttribute;
\r
50 public void CultureTest ()
\r
52 AssertEquals ("#Testing Culture",
\r
58 public void TypeIdTest ()
\r
60 AssertEquals ("#testing Typeid",
\r
62 typeof (AssemblyCultureAttribute)
\r
67 public void MatchTestForTrue ()
\r
69 AssertEquals ("#testing Match method-- for true",
\r
75 public void MatchTestForFalse ()
\r
77 AssertEquals ("#testing Match method-- for false",
\r
78 attr.Match (new AssemblyCultureAttribute ("Spanish")),
\r