public void TestImportCert() { X509Certificate2 cert = NewCertificate(); Assert.IsNotNull(cert); Assert.AreEqual(true, cert.HasPrivateKey); uut.Unlock("123"); WalletAccount account = uut.Import(cert); Assert.IsNotNull(account); }
public void TestVerifyPassword() { bool result = uut.VerifyPassword("123"); Assert.AreEqual(true, result); Assert.ThrowsException <ArgumentNullException>(() => uut.CreateAccount(keyPair.PrivateKey)); uut.Unlock("123"); uut.CreateAccount(keyPair.PrivateKey); result = uut.Contains(testScriptHash); Assert.AreEqual(true, result); result = uut.VerifyPassword("123"); Assert.AreEqual(true, result); uut.DeleteAccount(testScriptHash); Assert.AreEqual(false, uut.Contains(testScriptHash)); JObject wallet = new JObject(); wallet["name"] = "name"; wallet["version"] = new Version().ToString(); wallet["scrypt"] = new ScryptParameters(0, 0, 0).ToJson(); wallet["accounts"] = new JArray(); wallet["extra"] = new JObject(); uut = new NEP6Wallet(wallet); nep2key = keyPair.Export("123", 0, 0, 0); uut.Import(nep2key, "123", 0, 0, 0); Assert.IsFalse(uut.VerifyPassword("1")); Assert.IsTrue(uut.VerifyPassword("123")); }
public void TestImportNep2() { bool result = uut.Contains(testScriptHash); Assert.AreEqual(false, result); uut.Import(nep2key, "123", 0, 0, 0); result = uut.Contains(testScriptHash); Assert.AreEqual(true, result); uut.DeleteAccount(testScriptHash); result = uut.Contains(testScriptHash); Assert.AreEqual(false, result); JObject wallet = new JObject(); wallet["name"] = "name"; wallet["version"] = new Version().ToString(); wallet["scrypt"] = new ScryptParameters(0, 0, 0).ToJson(); wallet["accounts"] = new JArray(); wallet["extra"] = new JObject(); uut = new NEP6Wallet(wallet); result = uut.Contains(testScriptHash); Assert.AreEqual(false, result); uut.Import(nep2key, "123", 0, 0, 0); result = uut.Contains(testScriptHash); Assert.AreEqual(true, result); }