Exemplo n.º 1
0
        public void MultiFolderNothingModifiedTest()
        {
            IFileSystem mockFileSystem = GenerateMockFileSystem();

            PeachFolderPackager packager = new PeachFolderPackager(mockFileSystem);

            byte[] packedBytes = packager.PackFolder(@"c:\logs", _checkpoints[4].ToUniversalTime());

            MockFileSystem destinationFileSystem = new MockFileSystem();
            FolderUnpacker unpackager            = new FolderUnpacker(destinationFileSystem, "xyz");

            unpackager.UnpackFolder(@"c:\collectedlogs", packedBytes);

            Assert.AreEqual(0, destinationFileSystem.GetTotalFileCount());
            Assert.IsNull(unpackager.GetStatusFileStream());
        }
Exemplo n.º 2
0
        public void SingleFolderNullModifiedDatePackUnpackTest()
        {
            IFileSystem mockFileSystem = GenerateMockFileSystem();

            PeachFolderPackager packager = new PeachFolderPackager(mockFileSystem);

            byte[] packedBytes = packager.PackFolder(@"c:\logs\abc", new DateTime(0));

            MockFileSystem destinationFileSystem = new MockFileSystem();
            FolderUnpacker unpackager            = new FolderUnpacker(destinationFileSystem, "xyz");

            unpackager.UnpackFolder(@"c:\collectedlogs", packedBytes);

            Assert.AreEqual(4, destinationFileSystem.GetTotalFileCount());
            Assert.IsTrue(destinationFileSystem.FileExists(@"c:\collectedlogs\status-xyz.txt"));
            Assert.IsTrue(destinationFileSystem.FileExists(@"c:\collectedlogs\Faults\1\oatmeal.txt"));
            Assert.IsTrue(destinationFileSystem.FileExists(@"c:\collectedlogs\Faults\2\potatoes.txt"));
            Assert.IsTrue(destinationFileSystem.FileExists(@"c:\collectedlogs\Faults\3\carrots.txt"));

            Assert.IsNotNull(unpackager.GetStatusFileStream());
        }
Exemplo n.º 3
0
        public void DateSeparatedPackUnpackTest()
        {
            IFileSystem mockFileSystem = GenerateMockFileSystem();

            PeachFolderPackager packager = new PeachFolderPackager(mockFileSystem);

            byte[] packedBytes = packager.PackFolder(@"c:\logs\abc\", _checkpoints[0].ToUniversalTime());

            MockFileSystem destinationFileSystem = new MockFileSystem();
            FolderUnpacker unpackager            = new FolderUnpacker(destinationFileSystem, "xyz");

            unpackager.UnpackFolder(@"c:\collectedlogs\", packedBytes);

            //
            // Only 2 files should have been packed as they were the only ones modified after
            // checkpoint 0.
            //

            Assert.AreEqual(2, destinationFileSystem.GetTotalFileCount());
            Assert.IsTrue(destinationFileSystem.FileExists(@"c:\collectedlogs\status-xyz.txt"));
            Assert.IsTrue(destinationFileSystem.FileExists(@"c:\collectedlogs\Faults\3\carrots.txt"));

            Assert.IsNotNull(unpackager.GetStatusFileStream());
        }