Esempio n. 1
0
        public void WriteRead_Test()
        {
            var dataGenerator = new DataManager(_seed);
            var sourceStream  = dataGenerator.GenerateData(SourceStreamSize);
            var targetStream  = new MemoryStream();

            using (var repo = new ManagedRepository(BlockSize, ChecksumSize, _workDir))
            {
                using (var map = repo.Write(sourceStream))
                    using (new MapMonitor(map))
                    {
                        map.Start();
                        map.Wait();
                    }

                Console.WriteLine();

                using (var map = repo.Read(0, targetStream))
                    using (new MapMonitor(map))
                    {
                        map.Start();
                        map.Wait();
                    }
            }

            Assert.AreEqual(sourceStream, targetStream);
        }