public async Task ParallelExecuteAsync_Test()
        {
            var chain = await BlockchainService.GetChainAsync();

            (PrepareTransactions, KeyPairs) = await OsTestHelper.PrepareTokenForParallel(10);

            Block = OsTestHelper.GenerateBlock(chain.BestChainHash, chain.BestChainHeight, PrepareTransactions);
            //await BlockExecutingService.ExecuteBlockAsync(Block.Header, PrepareTransactions);
            await OsTestHelper.BroadcastTransactions(PrepareTransactions);

            Block = await MinerService.MineAsync(chain.BestChainHash, chain.BestChainHeight,
                                                 TimestampHelper.GetUtcNow(), TimestampHelper.DurationFromSeconds(4));

            await BlockchainService.AddBlockAsync(Block);

            await BlockAttachService.AttachBlockAsync(Block);

            SystemTransactions = await OsTestHelper.GenerateTransferTransactions(1);

            CancellableTransactions = OsTestHelper.GenerateTransactionsWithoutConflict(KeyPairs);
            Block = OsTestHelper.GenerateBlock(Block.GetHash(), Block.Height,
                                               SystemTransactions.Concat(CancellableTransactions));

            await OsTestHelper.BroadcastTransactions(SystemTransactions.Concat(CancellableTransactions));

            var block = await BlockExecutingService.ExecuteBlockAsync(Block.Header,
                                                                      SystemTransactions, CancellableTransactions, CancellationToken.None);

            block.TransactionIds.Count().ShouldBeGreaterThan(10);
        }
        public async Task ExecuteAsync_Test()
        {
            var chain = await BlockchainService.GetChainAsync();

            (PrepareTransactions, KeyPairs) = await OsTestHelper.PrepareTokenForParallel(10);

            Block = OsTestHelper.GenerateBlock(chain.BestChainHash, chain.BestChainHeight, PrepareTransactions);
            PrepareTransactions[0].To = SampleAccount.Accounts[0].Address;
            await OsTestHelper.BroadcastTransactions(PrepareTransactions);

            var executionReturnSets = await _transactionExecutingService.ExecuteAsync(new TransactionExecutingDto
            {
                Transactions = PrepareTransactions,
                BlockHeader  = Block.Header
            }, CancellationToken.None);

            executionReturnSets.Count.ShouldBe(PrepareTransactions.Count);
            executionReturnSets.Count(set => set.TransactionResult.Status == TransactionResultStatus.Failed)
            .ShouldBe(1);
            executionReturnSets.First(set => set.TransactionResult.Status == TransactionResultStatus.Failed).TransactionResult.Error.ShouldBe("Invalid contract address.");
            executionReturnSets.Count(set => set.TransactionResult.Status == TransactionResultStatus.Mined).ShouldBe(9);

            (PrepareTransactions, KeyPairs) = await OsTestHelper.PrepareTokenForParallel(10);

            Block = OsTestHelper.GenerateBlock(Block.GetHash(), Block.Height, PrepareTransactions);
            await OsTestHelper.BroadcastTransactions(PrepareTransactions);

            var cancelTokenSource = new CancellationTokenSource();

            cancelTokenSource.Cancel();
            executionReturnSets = await _transactionExecutingService.ExecuteAsync(new TransactionExecutingDto
            {
                Transactions = PrepareTransactions,
                BlockHeader  = Block.Header
            }, cancelTokenSource.Token);

            executionReturnSets.Count.ShouldBe(0);

            (PrepareTransactions, KeyPairs) = await OsTestHelper.PrepareTokenForParallel(10);

            Block = OsTestHelper.GenerateBlock(Block.GetHash(), Block.Height, PrepareTransactions);
            _systemTransactionExtraDataProvider.SetSystemTransactionCount(1, Block.Header);
            executionReturnSets = await _transactionExecutingService.ExecuteAsync(new TransactionExecutingDto
            {
                Transactions = PrepareTransactions,
                BlockHeader  = Block.Header
            }, CancellationToken.None);

            executionReturnSets.Count.ShouldBe(PrepareTransactions.Count);
            executionReturnSets.ShouldAllBe(set => set.TransactionResult.Status == TransactionResultStatus.Mined);
        }