public void BlockIsInvalidatedAfterChange() { var sut = new BlockChain.Block <MyData> ( new MyData(108, "Hello"), null, new ProofOfWork()); Assert.True(sut.IsValid()); var blockJSON = sut.ToString().Replace("Hello", "Changed"); sut = DeserializeObject <BlockChain.Block <MyData> > (blockJSON); Assert.False(sut.IsValid()); }
public void BlockCanBeSerializedAndDeSerialized() { var sut = new BlockChain.Block <MyData> ( new MyData( 108, "Hello"), null, new ProofOfWork() ); var blockJSON = sut.ToString(); sut = null; sut = DeserializeObject <BlockChain.Block <MyData> > (blockJSON); Assert.True(sut.IsValid()); }