Beispiel #1
0
        public void CopyDirectory()
        {
            var t = new CopyDirectoryTask(_source, _dest, DestinationCleanOptions.None, new DotNetPath());
            t.Execute();

            var s = File.ReadAllText(_path.Combine(_dest, "test.txt"));
            Assert.AreEqual("the test\r\n", s);
        }
            public override void Context()
            {
                base.Context();
                Directory.CreateDirectory(base.destDir);
                var destDir = new DirectoryInfo(base.destDir);
                destDir.Attributes = FileAttributes.ReadOnly;

                task = new CopyDirectoryTask(sourceDir, base.destDir, null, DestinationCleanOptions.None, null, new DotNetPath());
            }
 public override void Context()
 {
     base.Context();
     task = new CopyDirectoryTask(_source, _dest, DestinationCleanOptions.None, new DotNetPath());
 }
            public override void Context()
            {
                base.Context();
                Directory.CreateDirectory(destDir);
                var dest = Path.Combine(destDir, "test.txt");
                File.WriteAllLines(dest, new[] { "bad file" });
                var destFile = new FileInfo(dest);
                destFile.IsReadOnly = true;
                Assert.IsTrue(destFile.IsReadOnly, "Expected the destination file to be readonly");

                task = new CopyDirectoryTask(sourceDir, destDir, null, DestinationCleanOptions.None, null, new DotNetPath());
            }
 public override void Context()
 {
     base.Context();
     Directory.CreateDirectory(destDir);
     task = new CopyDirectoryTask(sourceDir, destDir, null, DestinationCleanOptions.None, null, new DotNetPath());
 }
            public override void Context()
            {
                base.Context();
                Directory.CreateDirectory(destDir);
                var dest = Path.Combine(destDir, "test.txt");
                File.WriteAllLines(dest, new[] { "bad file" });

                task = new CopyDirectoryTask(sourceDir, destDir, null, DestinationCleanOptions.Delete, null, new DotNetPath());
            }
            public override void Context()
            {
                base.Context();
                Directory.CreateDirectory(destDir);
                string subdirectory = Path.Combine(destDir, "sub");
                Directory.CreateDirectory(subdirectory);
                var dest = Path.Combine(destDir, "test.txt");
                File.WriteAllLines(dest, new[] { "bad file" });
                File.WriteAllLines(Path.Combine(destDir, "notcleared.txt"), new[] { "old" });
                subdirectoryFile = Path.Combine(subdirectory, "app_offline.htm");
                File.WriteAllLines(subdirectoryFile, new[] { "ignored" });

                IList<Regex> clearIgnoredPatterns = new List<Regex>();
                clearIgnoredPatterns.Add(new Regex("notcleared*"));
                clearIgnoredPatterns.Add(new Regex(@"[Aa]pp_[Oo]ffline\.htm"));

                task = new CopyDirectoryTask(sourceDir, destDir, null, DestinationCleanOptions.Clear, clearIgnoredPatterns, new DotNetPath());
            }
            public override void Context()
            {
                base.Context();

                File.WriteAllLines(Path.Combine(sourceDir, "notcopied.txt"), new[] { "new" });
                Directory.CreateDirectory(destDir);
                var dest = Path.Combine(destDir, "test.txt");
                File.WriteAllLines(dest, new[] { "bad file" });

                IList<Regex> ignoredCopyPatterns = new List<Regex>();
                ignoredCopyPatterns.Add(new Regex("notcopied*"));

                task = new CopyDirectoryTask(sourceDir, destDir, ignoredCopyPatterns, DestinationCleanOptions.Clear, null, new DotNetPath());
            }