[LoongArch64] Part-5:add loongarch support in some files for LoongArch64. (#21769)
[mono-project.git] / mcs / class / corlib / Test / System.Reflection / AssemblyDelaySignAttributeTest.cs
blobc903c20057904105da61d664c6ba4d39ed17882a
1 // AssemblyDelaySignAttributeTest.cs
2 //
3 // Author: Vineeth N <nvineeth@yahoo.com>
4 //
5 // (C) 2004 Ximian, Inc. http://www.ximian.com
6 //
8 using System;
9 using System.Threading;
10 using System.Reflection;
11 using System.Reflection.Emit;
12 using NUnit.Framework;
14 namespace MonoTests.System.Reflection {
16 /// <summary>
17 /// Summary description for AssemblyDelaySignAttributeTest.
18 /// </summary>
19 [TestFixture]
20 public class AssemblyDelaySignAttributeTest
22 #if !MOBILE
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;
50 [Test]
51 public void DelaySignTest ()
53 Assert.AreEqual (
54 attr.DelaySign,
55 false, "#1");
58 [Test]
59 public void TypeIdTest ()
61 Assert.AreEqual (
62 attr.TypeId,
63 typeof (AssemblyDelaySignAttribute)
64 , "#1");
67 [Test]
68 public void MatchTestForTrue ()
70 Assert.AreEqual (
71 attr.Match (attr),
72 true, "#1");
74 [Test]
75 public void MatchTestForFalse ()
77 Assert.AreEqual (
78 attr.Match (new AssemblyDelaySignAttribute (true)),
79 false, "#1");
81 #endif
83 [Test]
84 public void CtorTest ()
86 var a = new AssemblyDelaySignAttribute (true);
87 Assert.AreEqual (true, a.DelaySign);