示例#1
0
        public void WalletStore_GetData()
        {
            DataFolder dataFolder = CreateDataFolder(this);

            WalletStore store1 = new WalletStore(this.Network, dataFolder, new Types.Wallet {
                Name = "wallet1", EncryptedSeed = "EncryptedSeed1"
            });

            store1.GetData().Should().NotBeNull();
            store1.GetData().WalletTip.Height.Should().Be(0);
            store1.GetData().WalletTip.Hash.Should().Be(this.Network.GenesisHash);
            store1.GetData().WalletName.Should().Be("wallet1");
            store1.GetData().EncryptedSeed.Should().Be("EncryptedSeed1");

            var data = store1.GetData();

            data.BlockLocator = new List <uint256>()
            {
                new uint256(1), new uint256(2)
            };
            data.WalletTip = new Utilities.HashHeightPair(new uint256(2), 2);
            store1.SetData(data);

            store1.Dispose();

            WalletStore store2 = new WalletStore(this.Network, dataFolder, new Types.Wallet {
                Name = "wallet1", EncryptedSeed = "EncryptedSeed1"
            });

            store2.GetData().WalletTip.Height.Should().Be(2);
            store2.GetData().WalletTip.Hash.Should().Be(new uint256(2));
            store2.GetData().BlockLocator.Should().HaveCount(2);

            store2.Dispose();
        }