Exemple #1
0
        public void CanLoadPublicKeyFromKey()
        {
            string keyFile = Path.Combine(KeyDir, "test.snk");

            var loader = new StrongNameKeyLoader();

            loader.LoadPublicKey(keyFile);
        }
Exemple #2
0
        public void LoadPublicKeyThrowsFileNotFoundException()
        {
            string keyFile = Path.Combine(KeyDir, "unknown.snk");

            var    loader = new StrongNameKeyLoader();
            Action method = () => loader.LoadPublicKey(keyFile);

            method.Should()
            .Throw <FileNotFoundException>();
        }
Exemple #3
0
        public void LoadKeyThrowsInvalidKeyExceptionForPublicKey()
        {
            string keyFile = Path.Combine(KeyDir, "test_public_sha1.snk");

            var    loader = new StrongNameKeyLoader();
            Action method = () => loader.LoadKey(keyFile);

            method.Should()
            .Throw <InvalidKeyException>();
        }
Exemple #4
0
        public void CanLoadKeyGeneratedBySn()
        {
            string keyFile = Path.Combine(KeyDir, "test.snk");

            var           loader = new StrongNameKeyLoader();
            StrongNameKey key    = loader.LoadKey(keyFile);

            key.SignatureSize.Should()
            .Be(1024 / 8);
        }
Exemple #5
0
        public void CanLoadPublicKeyGeneratedBySn()
        {
            string keyFile = Path.Combine(KeyDir, "test_public_sha1.snk");

            var loader = new StrongNameKeyLoader();
            StrongNamePublicKey key = loader.LoadPublicKey(keyFile);

            key.HashAlgorithm.Should()
            .Be(AssemblyHashAlgorithm.SHA1);

            key.SignatureAlgorithm.Should()
            .Be(SignatureAlgorithm.CALG_RSA_SIGN);
        }