Exemplo n.º 1
0
        public void TestCachedFind_Empty()
        {
            var snapshot = TestBlockchain.GetStore().GetSnapshot();
            var storages = snapshot.Storages;
            var cache    = new CloneCache <StorageKey, StorageItem>(storages);

            storages.DeleteWhere((k, v) => k.ScriptHash == UInt160.Zero);

            cache.Add
            (
                new StorageKey()
            {
                Key = new byte[] { 0x00, 0x02 }, ScriptHash = UInt160.Zero
            },
                new StorageItem()
            {
                IsConstant = false, Value = new byte[] { }
            }
            );
            cache.Add
            (
                new StorageKey()
            {
                Key = new byte[] { 0x01, 0x02 }, ScriptHash = UInt160.Zero
            },
                new StorageItem()
            {
                IsConstant = false, Value = new byte[] { }
            }
            );

            CollectionAssert.AreEqual(
                Enumerable.Select <KeyValuePair <StorageKey, StorageItem>, byte>(cache.Find(new byte[21]), u => u.Key.Key[1]).ToArray(),
                new byte[] { 0x02 }
                );

            storages.DeleteWhere((k, v) => k.ScriptHash == UInt160.Zero);
        }
Exemplo n.º 2
0
 public void TestSetup()
 {
     TestBlockchain.InitializeMockNeoSystem();
 }