public AssemblyAlgorithmIdAttributeTest() { //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(AssemblyAlgorithmIdAttribute); ConstructorInfo ctrInfo = attribute.GetConstructor( new Type [] { typeof(AssemblyHashAlgorithm) } ); CustomAttributeBuilder attrBuilder = new CustomAttributeBuilder( ctrInfo, new object [1] { AssemblyHashAlgorithm.MD5 } ); dynAssembly.SetCustomAttribute(attrBuilder); object [] attributes = dynAssembly.GetCustomAttributes(true); attr = attributes [0] as AssemblyAlgorithmIdAttribute; }
public static void AssemblyAlgorithmIdAttributeTests() { var attr1 = new AssemblyAlgorithmIdAttribute(System.Configuration.Assemblies.AssemblyHashAlgorithm.SHA512); Assert.Equal((uint)System.Configuration.Assemblies.AssemblyHashAlgorithm.SHA512, attr1.AlgorithmId); var attr2 = new AssemblyAlgorithmIdAttribute(0u); Assert.Equal((uint)System.Configuration.Assemblies.AssemblyHashAlgorithm.None, attr2.AlgorithmId); }
public void Ctor_UInt(uint algorithmId) { var attribute = new AssemblyAlgorithmIdAttribute(algorithmId); Assert.Equal(algorithmId, attribute.AlgorithmId); }
public void Ctor_AssemblyHashAlgorithm(Configuration.Assemblies.AssemblyHashAlgorithm algorithmId) { var attribute = new AssemblyAlgorithmIdAttribute(algorithmId); Assert.Equal((uint)algorithmId, attribute.AlgorithmId); }
public static void setHashAlgoritm(AssemblyHashAlgorithm algHash, Type t) { AssemblyAlgorithmIdAttribute alg = new AssemblyAlgorithmIdAttribute(algHash); }
public void CtorTest() { var a = new AssemblyAlgorithmIdAttribute(AssemblyHashAlgorithm.SHA256); Assert.AreEqual((uint)AssemblyHashAlgorithm.SHA256, a.AlgorithmId); }