Exemplo n.º 1
0
        public void CreatesTargetFile()
        {
            IDirectoryObject sourceDirectory = DirectoryHelper.CreateDirectoryWithFile();

            IDirectoryObject targetDirectory = new MemoryDirectoryObject("directory");
            var syncNet = new Processor(sourceDirectory, targetDirectory, new SyncTaskQueue());

            syncNet.ProcessSourceDirectory();

            var targetFile = targetDirectory.GetFile(DirectoryHelper.FileName);

            Assert.IsTrue(targetFile.Exists);
        }
Exemplo n.º 2
0
        public void WritesFileContentToTargetFile()
        {
            IDirectoryObject sourceDirectory = DirectoryHelper.CreateDirectoryWithFile();

            IDirectoryObject targetDirectory = new MemoryDirectoryObject("directory");
            var syncNet = new Processor(sourceDirectory, targetDirectory, new SyncTaskQueue());

            syncNet.ProcessSourceDirectory();

            var targetFile = targetDirectory.GetFile(DirectoryHelper.FileName);

            using (var sr = new StreamReader(targetFile.GetStream()))
            {
                var targetFileContents = sr.ReadToEnd().Replace("\0", string.Empty);
                Assert.AreEqual(DirectoryHelper.Contents, targetFileContents);
            }
        }