public void Test_copying_all_files() { const string srcDirPath = "TestData\\TestSrcDir"; const string dstDirPath = "TestData\\TestDstDir"; try { var copyFilesDeploymentStep = new CopyFilesDeploymentStep( _directoryAdapter, _fileAdapter, new Lazy<string>(() => srcDirPath), new Lazy<string>(() => dstDirPath)); copyFilesDeploymentStep.PrepareAndExecute(); Assert.IsTrue(Directory.Exists(dstDirPath)); Assert.AreEqual( Directory.GetFiles(srcDirPath, "*.*", SearchOption.AllDirectories).Length, Directory.GetFiles(dstDirPath, "*.*", SearchOption.AllDirectories).Length); } finally { if (Directory.Exists(dstDirPath)) { Directory.Delete(dstDirPath, true); } } }
public void Test_copying_all_files_throws_when_no_src() { const string srcDirPath = "TestData\\aoisdiasyd"; const string dstDirPath = "TestData\\TestDstDir"; try { var copyFilesDeploymentStep = new CopyFilesDeploymentStep(srcDirPath, dstDirPath); Assert.Throws<DeploymentTaskException>(copyFilesDeploymentStep.PrepareAndExecute); } finally { if (Directory.Exists(dstDirPath)) { Directory.Delete(dstDirPath, true); } } }
public void Test_copying_all_files_when_dst_exists() { const string srcDirPath = "TestData\\TestSrcDir"; const string dstDirPath = "TestData\\TestDstDir"; try { Directory.CreateDirectory(dstDirPath); var copyFilesDeploymentStep = new CopyFilesDeploymentStep(srcDirPath, dstDirPath); copyFilesDeploymentStep.PrepareAndExecute(); Assert.IsTrue(Directory.Exists(dstDirPath)); Assert.AreEqual( Directory.GetFiles(srcDirPath, "*.*", SearchOption.AllDirectories).Length, Directory.GetFiles(dstDirPath, "*.*", SearchOption.AllDirectories).Length); } finally { if (Directory.Exists(dstDirPath)) { Directory.Delete(dstDirPath, true); } } }