コード例 #1
0
        public void DeriveEntropyXprv_ExceptionTest()
        {
            var bip85 = new BIP0085(Xprv);

            bip85.Dispose();
            Assert.Throws <ObjectDisposedException>(() => bip85.DeriveEntropyXprv(1));
        }
コード例 #2
0
        public void DeriveEntropyHex_ExceptionTest()
        {
            var bip85 = new BIP0085(Xprv);

            Assert.Throws <ArgumentOutOfRangeException>(() => bip85.DeriveEntropyHex(-1, 0));
            Assert.Throws <ArgumentOutOfRangeException>(() => bip85.DeriveEntropyHex(15, 0));
            Assert.Throws <ArgumentOutOfRangeException>(() => bip85.DeriveEntropyHex(65, 0));

            bip85.Dispose();
            Assert.Throws <ObjectDisposedException>(() => bip85.DeriveEntropyHex(16, 0));
        }
コード例 #3
0
        public void DeriveEntropy_ExceptionTest()
        {
            var bip85    = new BIP0085(Xprv);
            var badPath  = new BIP0032Path(1);
            var badPath2 = new BIP0032Path("m/1'/0/0'");

            Assert.Throws <ArgumentNullException>(() => bip85.DeriveEntropy(null));
            Assert.Throws <ArgumentException>(() => bip85.DeriveEntropy(badPath));
            Assert.Throws <ArgumentException>(() => bip85.DeriveEntropy(badPath2));

            bip85.Dispose();
            Assert.Throws <ObjectDisposedException>(() => bip85.DeriveEntropy(new BIP0032Path(uint.MaxValue)));
        }
コード例 #4
0
        public void DeriveEntropyBip39_ExceptionTest()
        {
            var bip85 = new BIP0085(Xprv);
            var wl    = (BIP0039.WordLists) 1000;

            Exception ex = Assert.Throws <ArgumentException>(() => bip85.DeriveEntropyBip39(wl, 12, 0));

            Assert.Contains("Word-list is not defined.", ex.Message);

            ex = Assert.Throws <ArgumentException>(() => bip85.DeriveEntropyBip39(BIP0039.WordLists.English, 0, 0));
            Assert.Contains("Invalid seed length", ex.Message);

            bip85.Dispose();
            Assert.Throws <ObjectDisposedException>(() => bip85.DeriveEntropyBip39(BIP0039.WordLists.English, 12, 0));
        }