示例#1
0
        public void IsGenesisBloq_PreviousHashIsGenesisHash_ReturnsTrue()
        {
            // Arrange
            int      index     = 5;
            int      nonce     = 0;
            string   data      = "Hello, I'm some data";
            DateTime timestamp = DateTime.UtcNow;

            var bloq = new Bloq <string>(index, nonce, timestamp, data, "Some Hash");

            bloq.PreviousHash = BloqHashing.GetGenesisHash();

            // Act
            bool result = bloq.IsGenesisBloq;

            // Assert
            Assert.True(result);
        }
示例#2
0
        public void Indexer_ValidIndex_GetsBloq()
        {
            // Arrange
            string data = "Some data";

            var chain = new BloqChain <string>(difficulty: 0);

            chain.AddBloq(data);

            // Act
            var bloq0 = chain[0];
            var bloq1 = chain[1];

            // Assert
            Assert.NotNull(bloq0);
            Assert.Equal(BloqHashing.GetGenesisHash(), bloq0.PreviousHash);

            Assert.NotNull(bloq1);
            Assert.Equal(data, bloq1.Data);
        }