Ejemplo n.º 1
0
        public void DoNotCompressAlreadyCompressedFiles()
        {
            // Arrange
            //FileHandler fileHandler = new JpgFileHandler();

            var fileSystem = new FileSystem();
            fileSystem.DeleteDirectoryAndAllFiles(TestConstants.NewDirectory);
            fileSystem.DeleteDirectoryAndAllFiles(TestConstants.TempDirectory);
            IFileHandler fileHandler = _fileHandlerFactory.GetFileHandler(TestConstants.ExistingJpgFullFileName, fileSystem);
            IPictureDirectory tempDir = _directoryFactory.GetOrCreateDirectory(TestConstants.TempDirectory);
            IPictureDirectory newDir = _directoryFactory.GetOrCreateDirectory(TestConstants.NewDirectory);
            string originalFileName = fileHandler.FileName;
            string tempFileName = fileHandler.PerformRenameAndMove(tempDir);
            string compressedFileName = fileHandler.PerformCompressAndMove(newDir);
            bool caughtExpectedException = false;

            // Act
            try {
                string compressedFileName2 = fileHandler.PerformCompressAndMove(tempDir);
            } catch (IOException) {
                caughtExpectedException = true;
            }

            // Assert
            Assert.IsTrue(caughtExpectedException);
        }
Ejemplo n.º 2
0
 public static void MyClassCleanup()
 {
     var fs = new FileSystem();
     fs.DeleteDirectoryAndAllFiles(TestConstants.ExistingDirectory);
     fs.DeleteDirectoryAndAllFiles(TestConstants.NewDirectory);
     fs.DeleteDirectoryAndAllFiles(TestConstants.TempDirectory);
     fs.DeleteDirectoryAndAllFiles(TestConstants.NonExistingDirectory);
 }
Ejemplo n.º 3
0
 public void MyTestInitialize()
 {
     var fs = new FileSystem();
     fs.DeleteDirectoryAndAllFiles(TestConstants.ExistingDirectory);
     fs.DeleteDirectoryAndAllFiles(TestConstants.NewDirectory);
     fs.DeleteDirectoryAndAllFiles(TestConstants.TempDirectory);
     fs.DeleteDirectoryAndAllFiles(TestConstants.NonExistingDirectory);
     fs.CreateDirectory(TestConstants.ExistingDirectory);
     fs.CopyFiles("TestData", TestConstants.ExistingDirectory);
 }