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

            var loader = new StrongNameKeyLoader();

            loader.LoadPublicKey(keyFile);
        }
Beispiel #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>();
        }
Beispiel #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>();
        }
Beispiel #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);
        }
Beispiel #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);
        }