public void Test_copying_all_files() { const string srcDirPath = "Core\\TestData\\TestSrcDir"; const string dstDirPath = "Core\\TestData\\TestDstDir"; try { var copyFilesDeploymentStep = new CopyFilesDeploymentStep( _directoryAdapter, 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 = "Core\\TestData\\aoisdiasyd"; const string dstDirPath = "Core\\TestData\\TestDstDir"; try { var copyFilesDeploymentStep = new CopyFilesDeploymentStep( _directoryAdapter, new Lazy<string>(() => srcDirPath), new Lazy<string>(() => dstDirPath)); Assert.Throws<DeploymentTaskException>(() => copyFilesDeploymentStep.PrepareAndExecute()); } finally { if (Directory.Exists(dstDirPath)) { Directory.Delete(dstDirPath, true); } } }