コード例 #1
0
        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);
            }
              }
        }
コード例 #2
0
        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);
            }
              }
        }