예제 #1
0
        private static (MemoryStream baseDataStream, MemoryStream baseSignatureStream, byte[] newData, MemoryStream newDataStream) PrepareTestDataWithOctodiffSignature(int baseNumberOfBytes, int newDataNumberOfBytes,
                                                                                                                                                                        short chunkSize)
        {
            var baseData = new byte[baseNumberOfBytes];

            new Random().NextBytes(baseData);
            var baseDataStream      = new MemoryStream(baseData);
            var baseSignatureStream = new MemoryStream();

            var signatureBuilder = new OctodiffSignatureBuilder
            {
                ChunkSize = chunkSize
            };

            signatureBuilder.Build(baseDataStream, new OctodiffSignatureWriter(baseSignatureStream));
            baseSignatureStream.Seek(0, SeekOrigin.Begin);

            var newData = new byte[newDataNumberOfBytes];

            new Random().NextBytes(newData);
            var newDataStream = new MemoryStream(newData);

            return(baseDataStream, baseSignatureStream, newData, newDataStream);
        }