예제 #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");
        }
예제 #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();
 }
예제 #5
0
 public void WhenTryToCopyANonExistentFileSouldThrownAnException()
 {
     var fileOperation = new CopierFiles(@"C:\Test\text.txt", @"C:\Destination");
     fileOperation.SimpleFileCopy();
 }
예제 #6
0
 public void TryToCopyFileWhenThwSourceIsADirectoryInsteadOfFile()
 {
     var fileOperator = new CopierFiles(@"C:\Test\New", @"D:\Destination");
     fileOperator.CopyFileUsingFileInfo();
 }
예제 #7
0
 public void TryCopyAllFileWhenTheSourcePathIsAFile()
 {
     var fileOperator = new CopierFiles(@"C:\Test\test.txt", @"D:\Destination");
     fileOperator.CopyAllFiles();
 }
예제 #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"));
 }
예제 #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"));
 }
예제 #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"));
 }