public void get_state_returns_expected()
        {
            var expected  = Neo.Utility.StrictUTF8.GetBytes("this is a test");
            var rpcClient = new TestableRpcClient(() => Convert.ToBase64String(expected));
            var actual    = rpcClient.GetState(UInt256.Zero, UInt160.Zero, default);

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 2
0
        public void cached_get_state_returns_expected()
        {
            var key      = Neo.Utility.StrictUTF8.GetBytes("key");
            var expected = Neo.Utility.StrictUTF8.GetBytes("this is a test");

            using var rpcClient = new TestableRpcClient(() => Convert.ToBase64String(expected));

            var tempPath = RocksDbUtility.GetTempPath();

            using var _      = Utility.GetDeleteDirectoryDisposable(tempPath);
            using var client = new StateServiceStore.RocksDbCacheClient(rpcClient, tempPath);

            var actual1 = client.GetState(UInt256.Zero, UInt160.Zero, key);
            var actual2 = client.GetState(UInt256.Zero, UInt160.Zero, key);

            Assert.Equal(expected, actual1);
            Assert.Equal(expected, actual2);
        }