public AssemblySignatureKeyAttributeTest() { //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(AssemblySignatureKeyAttribute); ConstructorInfo ctrInfo = attribute.GetConstructor( new Type [] { typeof(string), typeof(string) } ); CustomAttributeBuilder attrBuilder = new CustomAttributeBuilder(ctrInfo, new object [2] { "PublicKey", "CounterSignature" }); dynAssembly.SetCustomAttribute(attrBuilder); object [] attributes = dynAssembly.GetCustomAttributes(true); attr = attributes [0] as AssemblySignatureKeyAttribute; }
public void Ctor_String_String(string publicKey, string countersignature) { var attribute = new AssemblySignatureKeyAttribute(publicKey, countersignature); Assert.Equal(publicKey, attribute.PublicKey); Assert.Equal(countersignature, attribute.Countersignature); }
public void CtorTest() { var a = new AssemblySignatureKeyAttribute("some text", "some other text"); Assert.AreEqual("some text", a.PublicKey); Assert.AreEqual("some other text", a.Countersignature); }
public static void AssemblySignatureKeyAttributeTests() { var attr1 = new AssemblySignatureKeyAttribute(null, null); Assert.Null(attr1.Countersignature); Assert.Null(attr1.PublicKey); var attr2 = new AssemblySignatureKeyAttribute("public_key", "counter_signature"); Assert.Equal("public_key", attr2.PublicKey); Assert.Equal("counter_signature", attr2.Countersignature); }