Esempio n. 1
0
        public void AddFiftyBlocksAndCheckRangeRetrieval()
        {
            foreach (IChainStorageProvider store in stores)
            {
                ResetStore(store);

                var Node = new BlockChainNode(new System.Security.Cryptography.SHA512Managed());
                Node.Initiate(null, store);

                for (int i = 0; i < 50; i++)
                {
                    Node.SubmitData($"Block number {i+1}");
                }

                List <Block> blockList = Node.RetrieveMany(22, 5);

                Assert.Equal(5, blockList.Count);
                // the reason we expect this to be block with data "21"
                //  is because of the additional geness block
                for (int i = 0; i <= 4; i++)
                {
                    Assert.Equal($"Block number 2{i+1}", blockList[i].Data);
                }
            }
        }