Exemple #1
0
        private static void Main(string[] args)
        {
            var fileCopy = new CopierFiles(@"C:\Test\xxx.txt", @"C:\Destination");
            try
            {
                fileCopy.SimpleFileCopy();
                fileCopy.CopyAllFiles();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            var allFileCopy = new CopierFiles(@"C:\Test3", @"C:\Destination");

            try
            {
                allFileCopy.CopyAllFiles();
                fileCopy.CopyFileUsingFileInfo();
                fileCopy.CopyFileUsingStream();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            var copyDirectory = new CopierDirectory(@"C:\Test2", @"C:\Destination");
            copyDirectory.CopyDirectoryRecursiv();
            copyDirectory.CopyDirectoryEasier();

            copyDirectory.CopyDirectory(@"C:\Test2", @"C:\Dest");
        }
Exemple #2
0
 public void CopyAllFileFromADirectory()
 {
     var fileOperator = new CopierFiles(@"C:\Test\New", @"D:\Destination");
     fileOperator.CopyAllFiles();
     Assert.IsTrue(System.IO.File.Exists(@"D:\Destination\aaa.txt"));
     Assert.IsTrue(System.IO.File.Exists(@"D:\Destination\test.txt"));
 }
 public void WhenICopyInToFolder(string dest)
 {
     this.file = new CopierFiles(source, dest);
     this.file.SimpleFileCopy();
 }
 public void WhenICopyAllTheFileInToFolder(string dest)
 {
     this.file = new CopierFiles(source, dest);
     this.file.CopyAllFiles();
 }
Exemple #5
0
 public void WhenTryToCopyANonExistentFileSouldThrownAnException()
 {
     var fileOperation = new CopierFiles(@"C:\Test\text.txt", @"C:\Destination");
     fileOperation.SimpleFileCopy();
 }
Exemple #6
0
 public void TryToCopyFileWhenThwSourceIsADirectoryInsteadOfFile()
 {
     var fileOperator = new CopierFiles(@"C:\Test\New", @"D:\Destination");
     fileOperator.CopyFileUsingFileInfo();
 }
Exemple #7
0
 public void TryCopyAllFileWhenTheSourcePathIsAFile()
 {
     var fileOperator = new CopierFiles(@"C:\Test\test.txt", @"D:\Destination");
     fileOperator.CopyAllFiles();
 }
Exemple #8
0
 public void SingleFileCopy()
 {
     var fileOperation = new CopierFiles(@"C:\Test\test.txt", @"C:\Destination");
     fileOperation.SimpleFileCopy();
     Assert.IsTrue(System.IO.File.Exists(@"C:\Destination\test.txt"));
 }
Exemple #9
0
 public void CopyFileWithoutExtension()
 {
     var fileOperator = new CopierFiles(@"C:\Test\bbb", @"D:\Destination");
     fileOperator.CopyFileUsingFileInfo();
     Assert.IsTrue(System.IO.File.Exists(@"D:\Destination\bbb"));
 }
Exemple #10
0
 public void CopyFileUsingStreamReadAndWrite()
 {
     var fileOperator = new CopierFiles(@"C:\Test\ceva.txt", @"D:\Destination");
     fileOperator.CopyFileUsingStream();
     Assert.IsTrue(System.IO.File.Exists(@"D:\Destination\ceva.txt"));
 }