Beispiel #1
0
 public void TestGetKey()
 {
     account.GetKey().Should().BeNull();
     wallet.Unlock("Satoshi");
     account = new TLP6Account(wallet, hash, tlp2);
     account.GetKey().Should().Be(keyPair);
 }
Beispiel #2
0
        public void TestFromJson()
        {
            JObject json = new JObject();

            json["address"]   = "ARxgjcH2K1yeW5f5ryuRQNaBzSa9TZzmVS";
            json["key"]       = null;
            json["label"]     = null;
            json["isDefault"] = true;
            json["lock"]      = false;
            json["contract"]  = null;
            json["extra"]     = null;
            var account = TLP6Account.FromJson(json, wallet);

            account.ScriptHash.Should().Be("ARxgjcH2K1yeW5f5ryuRQNaBzSa9TZzmVS".ToScriptHash());
            account.Label.Should().BeNull();
            account.IsDefault.Should().BeTrue();
            account.Lock.Should().BeFalse();
            account.Contract.Should().BeNull();
            account.Extra.Should().BeNull();
            account.GetKey().Should().BeNull();

            json["key"]   = "6PYRjVE1gAbCRyv81FTiFz62cxuPGw91vMjN4yPa68bnoqJtioreTznezn";
            json["label"] = "label";
            account       = TLP6Account.FromJson(json, wallet);
            account.Label.Should().Be("label");
            account.HasKey.Should().BeTrue();
        }
Beispiel #3
0
 public void TestSetup()
 {
     wallet = TestUtils.GenerateTestWallet();
     byte[] array1 = { 0x01 };
     hash    = new UInt160(Crypto.Default.Hash160(array1));
     account = new TLP6Account(wallet, hash);
 }
Beispiel #4
0
        public void TestConstructorWithKeyPair()
        {
            TLP6Wallet wallet = new TLP6Wallet("a");

            byte[] array1   = { 0x01 };
            var    hash     = new UInt160(Crypto.Default.Hash160(array1));
            string password = "******";
            var    account  = new TLP6Account(wallet, hash, keyPair, password);

            account.ScriptHash.Should().Be(hash);
            account.Decrypted.Should().BeTrue();
            account.HasKey.Should().BeTrue();
        }
Beispiel #5
0
 public void TestGetKeyWithString()
 {
     account.GetKey("Satoshi").Should().BeNull();
     account = new TLP6Account(wallet, hash, tlp2);
     account.GetKey("Satoshi").Should().Be(keyPair);
 }
Beispiel #6
0
 public void TestVerifyPassword()
 {
     account = new TLP6Account(wallet, hash, tlp2);
     account.VerifyPassword("Satoshi").Should().BeTrue();
     account.VerifyPassword("b").Should().BeFalse();
 }