public async Task GivenBlockChain_WhenFile_WillRoundTrip() { ContractClient client = TestApplication.GetContractClient(); var documentId = new DocumentId("test/unit-tests-smart/contract1"); await Delete(documentId, false); var blkHeader = new BlkHeader { PrincipalId = "dev/user/[email protected]", DocumentId = (string)documentId, Creator = "test", Description = "test description", }; BlockChain blockChain = new BlockChainBuilder() .SetPrincipleId(blkHeader.PrincipalId) .Build() .Add(blkHeader, blkHeader.PrincipalId); BlockChainModel signedBlockChainModel = await client.Sign(blockChain.ToBlockChainModel()); signedBlockChainModel.Should().NotBeNull(); await client.Set(documentId, signedBlockChainModel); BlockChainModel readBlockChainModel = await client.Get(documentId); readBlockChainModel.Should().NotBeNull(); readBlockChainModel.Blocks.Count.Should().Be(signedBlockChainModel.Blocks.Count); readBlockChainModel.Blocks .Zip(signedBlockChainModel.Blocks) .All(x => x.First == x.Second) .Should().BeTrue(); bool isValid = await client.Validate(documentId); isValid.Should().BeTrue(); isValid = await client.Validate(readBlockChainModel); isValid.Should().BeTrue(); await Delete(documentId, true); }