-// AssemblyCultureAttributeTest.cs\r
-//\r
-// Author: Vineeth N <nvineeth@yahoo.com>\r
-//\r
-// (C) 2004 Ximian, Inc. http://www.ximian.com\r
-//\r
-\r
-using System;\r
-using System.Threading;\r
-using System.Reflection;\r
-using System.Reflection.Emit;\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.Reflection {\r
-\r
- /// <summary>\r
- /// Test Fixture for AssemblyCultureAttribute\r
- /// </summary>\r
- [TestFixture]\r
- public class AssemblyCultureAttributeTest : Assertion\r
- {\r
- private AssemblyBuilder dynAssembly;\r
- AssemblyName dynAsmName = new AssemblyName ();\r
- AssemblyCultureAttribute attr;\r
-\r
- public AssemblyCultureAttributeTest ()\r
- {\r
- //create a dynamic assembly with the required attribute\r
- //and check for the validity\r
-\r
- dynAsmName.Name = "TestAssembly";\r
-\r
- dynAssembly = Thread.GetDomain ().DefineDynamicAssembly (\r
- dynAsmName,AssemblyBuilderAccess.Run\r
- );\r
-\r
- // Set the required Attribute of the assembly.\r
- Type attribute = typeof (AssemblyCultureAttribute);\r
- ConstructorInfo ctrInfo = attribute.GetConstructor (\r
- new Type [] { typeof (string) }\r
- );\r
- CustomAttributeBuilder attrBuilder =\r
- new CustomAttributeBuilder (ctrInfo, new object [1] { "India" });\r
- dynAssembly.SetCustomAttribute (attrBuilder);\r
- object [] attributes = dynAssembly.GetCustomAttributes(true);\r
- attr = attributes [0] as AssemblyCultureAttribute;\r
- }\r
- \r
- [Test]\r
- public void CultureTest ()\r
- {\r
- AssertEquals ("#Testing Culture",\r
- attr.Culture,\r
- "India");\r
- }\r
-\r
- [Test]\r
- public void TypeIdTest ()\r
- {\r
- AssertEquals ("#testing Typeid",\r
- attr.TypeId,\r
- typeof (AssemblyCultureAttribute)\r
- );\r
- }\r
-\r
- [Test]\r
- public void MatchTestForTrue ()\r
- {\r
- AssertEquals ("#testing Match method-- for true",\r
- attr.Match (attr),\r
- true);\r
- }\r
-\r
- [Test]\r
- public void MatchTestForFalse ()\r
- { \r
- AssertEquals ("#testing Match method-- for false",\r
- attr.Match (new AssemblyCultureAttribute ("Spanish")),\r
- false);\r
- }\r
- }\r
-}\r
-\r
+// AssemblyCultureAttributeTest.cs
+//
+// Author: Vineeth N <nvineeth@yahoo.com>
+//
+// (C) 2004 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Threading;
+using System.Reflection;
+using System.Reflection.Emit;
+using NUnit.Framework;
+
+namespace MonoTests.System.Reflection {
+
+ /// <summary>
+ /// Test Fixture for AssemblyCultureAttribute
+ /// </summary>
+ [TestFixture]
+ public class AssemblyCultureAttributeTest : Assertion
+ {
+ private AssemblyBuilder dynAssembly;
+ AssemblyName dynAsmName = new AssemblyName ();
+ AssemblyCultureAttribute attr;
+
+ public AssemblyCultureAttributeTest ()
+ {
+ //create a dynamic assembly with the required attribute
+ //and check for the validity
+
+ dynAsmName.Name = "TestAssembly";
+
+ dynAssembly = Thread.GetDomain ().DefineDynamicAssembly (
+ dynAsmName,AssemblyBuilderAccess.Run
+ );
+
+ // Set the required Attribute of the assembly.
+ Type attribute = typeof (AssemblyCultureAttribute);
+ ConstructorInfo ctrInfo = attribute.GetConstructor (
+ new Type [] { typeof (string) }
+ );
+ CustomAttributeBuilder attrBuilder =
+ new CustomAttributeBuilder (ctrInfo, new object [1] { "India" });
+ dynAssembly.SetCustomAttribute (attrBuilder);
+ object [] attributes = dynAssembly.GetCustomAttributes(true);
+ attr = attributes [0] as AssemblyCultureAttribute;
+ }
+
+ [Test]
+ public void CultureTest ()
+ {
+ AssertEquals ("#Testing Culture",
+ attr.Culture,
+ "India");
+ }
+
+ [Test]
+ public void TypeIdTest ()
+ {
+ AssertEquals ("#testing Typeid",
+ attr.TypeId,
+ typeof (AssemblyCultureAttribute)
+ );
+ }
+
+ [Test]
+ public void MatchTestForTrue ()
+ {
+ AssertEquals ("#testing Match method-- for true",
+ attr.Match (attr),
+ true);
+ }
+
+ [Test]
+ public void MatchTestForFalse ()
+ {
+ AssertEquals ("#testing Match method-- for false",
+ attr.Match (new AssemblyCultureAttribute ("Spanish")),
+ false);
+ }
+ }
+}
+