All the unit tests run. There *may* be some other tasks that rely on the current broken behaviour (ie: expecting directories to appear in the FileNames collection). These tasks should be changed to use the FileSet.DirectoryNames collection as well as FileSet.FileNames.
We should probably add a property on the FileSet to get a list of *all* matching files.
// NAnt - A .NET build tool // Copyright (C) 2002 Scott Hernandez ([EMAIL PROTECTED]) // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// Scott Hernandez ([EMAIL PROTECTED]) using System; using System.IO; using System.Reflection; using System.Text; using System.Xml; using System.Globalization; using NUnit.Framework; using SourceForge.NAnt.Tasks; using SourceForge.NAnt.Attributes; namespace SourceForge.NAnt.Tests { /// <summary> /// <para>Tests the deletion of the following:</para> /// <para> /// <list type="test"> /// <item> file</item> /// <item> folder</item> /// <item> folder with a file (recursive)</item> /// </list> /// </para> /// </summary> /// <remarks>This test should also test for failures, like permission errors, and filesets</remarks> [TestFixture] public class CopyTest : BuildTestBase { const string _xmlProjectTemplate = @" <project> <copy verbose='true' todir='{0}'> <fileset> <includes name='{1}' /> </fileset> </copy> </project>"; const string _xmlProjectTemplate2 = @" <project> <mkdir dir='{0}/destination' /> <mkdir dir='{0}/source/test' /> <copy verbose='true' todir='{0}/destination' failonerror='true'> <fileset basedir='{0}'> <includes name='{0}/source/*' /> </fileset> </copy> </project> "; const string _xmlProjectTemplate3 = @" <project> <copy verbose='true' file='{0}' tofile='{1}' /> </project> "; string tempFile1, tempFile2, tempFile3, tempFile4, tempFile5, tempFile6, tempFile7; string tempDir1, tempDir2, tempDir3, tempDir4, tempDir5; /// <summary> /// Creates a structure like so: /// a.b\ /// a.bb /// a.bc /// foo\* /// x.x /// goo\* /// x\ /// y.y /// ha.he /// ha.he2* /// ha.he3* /// empty\ -- note: empty directory /// </summary> [SetUp] protected override void SetUp() { base.SetUp(); tempDir1 = CreateTempDir("a.b"); tempDir2 = CreateTempDir(Path.Combine(tempDir1, "foo")); tempDir3 = CreateTempDir(Path.Combine(tempDir1, "goo")); tempDir4 = CreateTempDir(Path.Combine(tempDir1, Path.Combine(tempDir3, "x"))); tempDir5 = CreateTempDir(Path.Combine(tempDir1, "empty")); tempFile1 = CreateTempFile(Path.Combine(tempDir1, "a.bb")); tempFile2 = CreateTempFile(Path.Combine(tempDir1, "a.bc")); tempFile3 = CreateTempFile(Path.Combine(tempDir2, "x.x")); tempFile4 = CreateTempFile(Path.Combine(tempDir4, "y.y")); tempFile5 = CreateTempFile(Path.Combine(tempDir3, "ha.he")); tempFile6 = CreateTempFile(Path.Combine(tempDir3, "ha.he2")); tempFile7 = CreateTempFile(Path.Combine(tempDir3, "ha.he3")); File.SetAttributes(tempDir2, FileAttributes.ReadOnly); File.SetAttributes(tempDir3, FileAttributes.ReadOnly); File.SetAttributes(Path.Combine(tempDir3, "ha.he3"), FileAttributes.ReadOnly); File.SetAttributes(Path.Combine(tempDir3, "ha.he2"), FileAttributes.ReadOnly); } private string GetPath( string rootPath, params string[] fileParts ) { string path = rootPath; foreach ( string filePart in fileParts ) { path = Path.Combine( path, Path.GetFileName( filePart ) ); } return path; } /// <summary> /// Copy only the directory given. /// </summary> [Test] public void Test_Copy_Only_Directory() { string results; string dest = CreateTempDir("a.99"); results = RunBuild(String.Format(CultureInfo.InvariantCulture, _xmlProjectTemplate, dest, tempDir1)); Assertion.Assert("File should not have been created:" + tempFile1, !File.Exists(GetPath(dest,tempDir1,tempFile1))); Assertion.Assert("File should not have been created:" + tempFile2, !File.Exists(GetPath(dest,tempDir1,tempFile2))); Assertion.Assert("File should not have been created:" + tempFile3, !File.Exists(GetPath(dest,tempDir1,tempDir2,tempFile3))); Assertion.Assert("File should not have been created:" + tempFile4, !File.Exists(GetPath(dest,tempDir1,tempDir3,tempDir4,tempFile4))); Assertion.Assert("File should not have been created:" + tempFile5, !File.Exists(GetPath(dest,tempDir1,tempDir3,tempFile5))); Assertion.Assert("File should not have been created:" + tempFile6, !File.Exists(GetPath(dest,tempDir1,tempDir3,tempFile6))); Assertion.Assert("File should not have been created:" + tempFile7, !File.Exists(GetPath(dest,tempDir1,tempDir3,tempFile7))); Assertion.Assert("Dir should have been created:" + tempDir1, Directory.Exists(GetPath(dest,tempDir1))); Assertion.Assert("Dir should not have been created:" + tempDir2, !Directory.Exists(GetPath(dest,tempDir1,tempDir2))); Assertion.Assert("Dir should not have been created:" + tempDir3, !Directory.Exists(GetPath(dest,tempDir1,tempDir3))); Assertion.Assert("Dir should not have been created:" + tempDir4, !Directory.Exists(GetPath(dest,tempDir1,tempDir3,tempDir4))); Assertion.Assert("Dir should not have been created:" + tempDir5, !Directory.Exists(GetPath(dest,tempDir1,tempDir5))); } /// <summary> /// Copy everything from under tempDir1 to a new temp directory and ensure it exists. /// </summary> [Test] public void Test_Copy_Structure() { string results; string dest = CreateTempDir("a.xx"); results = RunBuild(String.Format(CultureInfo.InvariantCulture, _xmlProjectTemplate, dest, tempDir1 + "\\**\\*" )); Assertion.Assert("File should have been created:" + tempFile1, File.Exists(GetPath(dest,tempDir1,tempFile1))); Assertion.Assert("File should have been created:" + tempFile2, File.Exists(GetPath(dest,tempDir1,tempFile2))); Assertion.Assert("File should have been created:" + tempFile3, File.Exists(GetPath(dest,tempDir1,tempDir2,tempFile3))); Assertion.Assert("File should have been created:" + tempFile4, File.Exists(GetPath(dest,tempDir1,tempDir3,tempDir4,tempFile4))); Assertion.Assert("File should have been created:" + tempFile5, File.Exists(GetPath(dest,tempDir1,tempDir3,tempFile5))); Assertion.Assert("File should have been created:" + tempFile6, File.Exists(GetPath(dest,tempDir1,tempDir3,tempFile6))); Assertion.Assert("File should have been created:" + tempFile7, File.Exists(GetPath(dest,tempDir1,tempDir3,tempFile7))); Assertion.Assert("Dir should have been created:" + tempDir1, Directory.Exists(GetPath(dest,tempDir1))); Assertion.Assert("Dir should have been created:" + tempDir2, Directory.Exists(GetPath(dest,tempDir1,tempDir2))); Assertion.Assert("Dir should have been created:" + tempDir3, Directory.Exists(GetPath(dest,tempDir1,tempDir3))); Assertion.Assert("Dir should have been created:" + tempDir4, Directory.Exists(GetPath(dest,tempDir1,tempDir3,tempDir4))); Assertion.Assert("Dir should have been created:" + tempDir5, Directory.Exists(GetPath(dest,tempDir1,tempDir5))); } [Test] public void Test_Copy_Structure_Overwrite() { string results; string dest = CreateTempDir("a.c"); results = RunBuild(String.Format(CultureInfo.InvariantCulture, _xmlProjectTemplate, dest, tempDir1 + "/**/*" )); Assertion.Assert("File should have been created:" + tempFile1, File.Exists(GetPath(dest,tempDir1,tempFile1))); Assertion.Assert("File should have been created:" + tempFile2, File.Exists(GetPath(dest,tempDir1,tempFile2))); Assertion.Assert("File should have been created:" + tempFile3, File.Exists(GetPath(dest,tempDir1,tempDir2,tempFile3))); Assertion.Assert("File should have been created:" + tempFile4, File.Exists(GetPath(dest,tempDir1,tempDir3,tempDir4,tempFile4))); Assertion.Assert("File should have been created:" + tempFile5, File.Exists(GetPath(dest,tempDir1,tempDir3,tempFile5))); Assertion.Assert("File should have been created:" + tempFile6, File.Exists(GetPath(dest,tempDir1,tempDir3,tempFile6))); Assertion.Assert("File should have been created:" + tempFile7, File.Exists(GetPath(dest,tempDir1,tempDir3,tempFile7))); Assertion.Assert("Dir should have been created:" + tempDir1, Directory.Exists(GetPath(dest,tempDir1))); Assertion.Assert("Dir should have been created:" + tempDir2, Directory.Exists(GetPath(dest,tempDir1,tempDir2))); Assertion.Assert("Dir should have been created:" + tempDir3, Directory.Exists(GetPath(dest,tempDir1,tempDir3))); Assertion.Assert("Dir should have been created:" + tempDir4, Directory.Exists(GetPath(dest,tempDir1,tempDir3,tempDir4))); Assertion.Assert("Dir should have been created:" + tempDir5, Directory.Exists(GetPath(dest,tempDir1,tempDir5))); // Set some read-only attributes File.SetAttributes(GetPath(dest,tempDir1,tempDir3,tempFile5), FileAttributes.ReadOnly); File.SetAttributes(GetPath(dest,tempDir1,tempDir2), FileAttributes.ReadOnly); // Delete some files and directories File.Delete(GetPath(dest,tempDir1,tempDir3,tempDir4,tempFile4)); File.Delete(GetPath(dest,tempDir1,tempDir2,tempFile3)); Directory.Delete(GetPath(dest,tempDir1,tempDir5)); // Run it again to overwrite results = RunBuild(String.Format(CultureInfo.InvariantCulture, _xmlProjectTemplate, dest, tempDir1 + "/**/*" )); Assertion.Assert("File should have been created:" + tempFile1, File.Exists(GetPath(dest,tempDir1,tempFile1))); Assertion.Assert("File should have been created:" + tempFile2, File.Exists(GetPath(dest,tempDir1,tempFile2))); Assertion.Assert("File should have been created:" + tempFile3, File.Exists(GetPath(dest,tempDir1,tempDir2,tempFile3))); Assertion.Assert("File should have been created:" + tempFile4, File.Exists(GetPath(dest,tempDir1,tempDir3,tempDir4,tempFile4))); Assertion.Assert("File should have been created:" + tempFile5, File.Exists(GetPath(dest,tempDir1,tempDir3,tempFile5))); Assertion.Assert("File should have been created:" + tempFile6, File.Exists(GetPath(dest,tempDir1,tempDir3,tempFile6))); Assertion.Assert("File should have been created:" + tempFile7, File.Exists(GetPath(dest,tempDir1,tempDir3,tempFile7))); Assertion.Assert("Dir should have been created:" + tempDir1, Directory.Exists(GetPath(dest,tempDir1))); Assertion.Assert("Dir should have been created:" + tempDir2, Directory.Exists(GetPath(dest,tempDir1,tempDir2))); Assertion.Assert("Dir should have been created:" + tempDir3, Directory.Exists(GetPath(dest,tempDir1,tempDir3))); Assertion.Assert("Dir should have been created:" + tempDir4, Directory.Exists(GetPath(dest,tempDir1,tempDir3,tempDir4))); Assertion.Assert("Dir should have been created:" + tempDir5, Directory.Exists(GetPath(dest,tempDir1,tempDir5))); } [Test] public void Test_Copy_Files_No_Overwrite() { string results; File.Delete( tempFile2 ); results = RunBuild(String.Format(CultureInfo.InvariantCulture, _xmlProjectTemplate3, tempFile1, tempFile2 )); Assertion.Assert("File should have been created:" + tempFile2, File.Exists(tempFile2)); } [Test] public void Test_Copy_Files_Overwrite() { string results; results = RunBuild(String.Format(CultureInfo.InvariantCulture, _xmlProjectTemplate3, tempFile1, tempFile2 )); Assertion.Assert("File should have been created:" + tempFile2, File.Exists(tempFile2)); } [Test] public void Test_Copy_Files_Overwrite_Readonly() { string results; File.SetAttributes(tempFile2, FileAttributes.ReadOnly); results = RunBuild(String.Format(CultureInfo.InvariantCulture, _xmlProjectTemplate3, tempFile1, tempFile2 )); Assertion.Assert("File should have been created:" + tempFile2, File.Exists(tempFile2)); } /// <summary> /// This test suggested by [EMAIL PROTECTED] Tests copying subdirectories only. /// </summary> [Test] public void Test_Copy_Structure_Directories() { string results = RunBuild(String.Format(CultureInfo.InvariantCulture, _xmlProjectTemplate2, tempDir1 )); Assertion.Assert("Dir should have been created:" + GetPath(tempDir1,"destination"), Directory.Exists(GetPath(tempDir1,"destination"))); Assertion.Assert("Dir should have been created:" + GetPath(tempDir1,"source","test"), Directory.Exists(GetPath(tempDir1,"source","test"))); Assertion.Assert("Dir should have been created:" + GetPath(tempDir1,"destination","source","test"), Directory.Exists(GetPath(tempDir1,"destination","source","test"))); } } }
Index: src/NAnt.Core/DirectoryScanner.cs =================================================================== RCS file: /cvsroot/nant/nant/src/NAnt.Core/DirectoryScanner.cs,v retrieving revision 1.4 diff -r1.4 DirectoryScanner.cs 291,296d290 < // test subfolder as member of fileset before scanning < string dirname = Path.Combine(path, directoryInfo.Name); < if (IsPathIncluded(dirname, caseSensitive)) { < _fileNames.Add(dirname); < } < //// Index: src/NAnt.Core/FileSet.cs =================================================================== RCS file: /cvsroot/nant/nant/src/NAnt.Core/FileSet.cs,v retrieving revision 1.6 diff -r1.6 FileSet.cs 133a134,144 > /// <summary>The collection of directory names that match the file > set.</summary> > public StringCollection DirectoryNames > { > get { > if (!_hasScanned) { > Scan(); > } > return _scanner.DirectoryNames; > } > } > 140c151,154 < _scanner.FileNames.Add(name); --- > if (Directory.Exists(name)) > _scanner.DirectoryNames.Add(name); > else > _scanner.FileNames.Add(name); Index: src/NAnt.Core/Project.cs =================================================================== RCS file: /cvsroot/nant/nant/src/NAnt.Core/Project.cs,v retrieving revision 1.6 diff -r1.6 Project.cs 284c284 < string message = "Error loading buildfile"; --- > string message = "Error loading buildfile: " + e.Message; Index: src/NAnt.Core/Tasks/CopyTask.cs =================================================================== RCS file: /cvsroot/nant/nant/src/NAnt.Core/Tasks/CopyTask.cs,v retrieving revision 1.4 diff -r1.4 CopyTask.cs 106c106 < Log.WriteLine(LogPrefix + "Copying {0} files to {1}", fileCount, Project.GetFullPath(ToDirectory)); --- > Log.WriteLine(LogPrefix + "Copying {0} file{1} to {2}", > fileCount, ( fileCount != 1 ) ? "s" : "", Project.GetFullPath(ToDirectory)); 108c108 < Log.WriteLine(LogPrefix + "Copying {0} files", fileCount); --- > Log.WriteLine(LogPrefix + "Copying {0} file{1}", fileCount, ( > fileCount != 1 ) ? "s" : "" ); 171c171,173 < } --- > if (dstInfo.Exists && > dstInfo.Attributes != FileAttributes.Normal) > File.SetAttributes( > dstInfo.FullName, FileAttributes.Normal ); > } 184,185c186,188 < // if source file not specified use fileset < foreach (string pathname in CopyFileSet.FileNames) { --- > // if source file not specified use fileset > foreach (string pathname in CopyFileSet.FileNames) > { 204a208,209 > if (dstInfo.Exists && > dstInfo.Attributes != FileAttributes.Normal) > File.SetAttributes( > dstInfo.FullName, FileAttributes.Normal ); 211c216,235 < } --- > > // Create any specified directories that weren't > created during the copy (ie: empty directories) > foreach (string pathname in > CopyFileSet.DirectoryNames) > { > DirectoryInfo srcInfo = new > DirectoryInfo(pathname); > string dstRelPath = > srcInfo.FullName.Substring(srcBaseInfo.FullName.Length); > if(dstRelPath.StartsWith("\\")) > { > dstRelPath = dstRelPath.Substring(1); > } > > // The full filepath to copy to. > string dstPath = > Path.Combine(dstBaseInfo.FullName, dstRelPath); > if (!Directory.Exists(dstPath)) > { > Log.WriteLineIf(Verbose, LogPrefix + > "Created directory {0}", dstPath); > Directory.CreateDirectory(dstPath); > } > } > } Index: src/NAnt.Core/Tasks/DeleteTask.cs =================================================================== RCS file: /cvsroot/nant/nant/src/NAnt.Core/Tasks/DeleteTask.cs,v retrieving revision 1.3 diff -r1.3 DeleteTask.cs 104,105c104,107 < DeleteDirectory(path); < --- > if (!Directory.Exists(path)) > throw new DirectoryNotFoundException(); > Log.WriteLine(LogPrefix + "Deleting directory {0}", > path); > RecursiveDeleteDirectory(path); 108c110,116 < Log.WriteLine(LogPrefix + "Deleting {0} files", DeleteFileSet.FileNames.Count); --- > if ( DeleteFileSet.DirectoryNames.Count == 0 ) > Log.WriteLine(LogPrefix + "Deleting {0} > files", DeleteFileSet.FileNames.Count); > else if ( DeleteFileSet.FileNames.Count == 0 ) > Log.WriteLine(LogPrefix + "Deleting {0} > directories", DeleteFileSet.DirectoryNames.Count); > else > Log.WriteLine(LogPrefix + "Deleting {0} files > and {1} directories", DeleteFileSet.FileNames.Count, > DeleteFileSet.DirectoryNames.Count); > 110c118 < DeleteFile(path, Verbose); --- > DeleteFile(path, Verbose); 112c120,124 < } --- > foreach (string path in DeleteFileSet.DirectoryNames) { > if (Directory.Exists(path)) > RecursiveDeleteDirectory(path); > } > } 115c127 < void DeleteDirectory(string path) { --- > void RecursiveDeleteDirectory(string path) { 117,122c129,155 < if (Directory.Exists(path)) { < Log.WriteLine(LogPrefix + "Deleting directory {0}", path); < Directory.Delete(path, true); < } else { < throw new DirectoryNotFoundException(); < } --- > // First, recursively delete all directories in the > directory > string[] dirs = Directory.GetDirectories(path); > foreach (string dir in dirs) > RecursiveDeleteDirectory(dir); > > // Next, delete all files in the directory > string[] files = Directory.GetFiles(path); > foreach (string file in files) { > try { > File.SetAttributes(file, > FileAttributes.Normal); > Log.WriteLineIf(Verbose, LogPrefix + > "Deleting file {0}", file); > File.Delete(file); > } > catch (Exception e) { > if (FailOnError) > { > string msg = > String.Format(CultureInfo.InvariantCulture, "Cannot delete file {0}", file); > throw new BuildException(msg, > Location, e); > } > Log.WriteLineIf(Verbose, LogPrefix + > "Error while deleting file {0}", file); > } > } > > // Finally, delete the directory > File.SetAttributes(path, FileAttributes.Normal); > Log.WriteLineIf(Verbose, LogPrefix + "Deleting > directory {0}", path); > Directory.Delete(path); 128c161,162 < } --- > Log.WriteLineIf(Verbose, LogPrefix + "Error while > deleting directory {0}", path); > } 133c167,168 < if (File.Exists(path)) { --- > FileInfo deleteInfo = new FileInfo( path ); > if (deleteInfo.Exists) { 134a170,171 > if ( deleteInfo.Attributes != > FileAttributes.Normal ) > File.SetAttributes( > deleteInfo.FullName, FileAttributes.Normal ); Index: src/NAnt.Core.Tests/FileSetTest.cs =================================================================== RCS file: /cvsroot/nant/nant/src/NAnt.Core.Tests/FileSetTest.cs,v retrieving revision 1.3 diff -r1.3 FileSetTest.cs 50c50,52 < } --- > string sub2Path = Path.Combine(TempDirName, "sub2"); > Directory.CreateDirectory(sub2Path); > } 79,81c81,85 < // Expect 6 - includng directory < Assertion.AssertEquals(6, _fileSet.FileNames.Count); < } --- > // Expect 5 - not including directory > Assertion.AssertEquals(5, _fileSet.FileNames.Count); > // Two directories, including one empty one > Assertion.AssertEquals(2, _fileSet.DirectoryNames.Count); > } 106c110,118 < void AssertMatch(string fileName) { --- > [Test] > public void Test_Includes_Sub2() > { > _fileSet.Includes.Add("sub2/**/*"); > Assertion.AssertEquals(0, _fileSet.FileNames.Count); > } > > void AssertMatch(string fileName) > { Index: src/NAnt.Core.Tests/Tasks/DeleteTest.cs =================================================================== RCS file: /cvsroot/nant/nant/src/NAnt.Core.Tests/Tasks/DeleteTest.cs,v retrieving revision 1.3 diff -r1.3 DeleteTest.cs 47,49c47 < <delete file='{0}'/> < <delete dir='{1}'/> < <delete dir='{2}'/> --- > <delete verbose='true' {0}='{1}'/> 50a49,59 > const string _xmlProjectTemplate2 = @" > <project> > <delete verbose='true'> > <fileset> > <includes name='{0}' /> > </fileset> > </delete> > </project>"; > > string tempFile1, tempFile2, tempFile3, tempFile4, tempFile5, > tempFile6, tempFile7; > string tempDir1, tempDir2, tempDir3, tempDir4; 52,55c61,74 < string tempFile; < string tempDir; < string tempFileInTempDirDir; < --- > /// <summary> > /// Creates a structure like so: > /// a.b\ > /// a.bb > /// a.bc > /// foo\* > /// x.x > /// goo\* > /// x\ > /// y.y > /// ha.he > /// ha.he2* > /// ha.he3* > /// </summary> 59,63c78,96 < tempFile = CreateTempFile("a.b"); < tempDir = CreateTempDir("foo"); < tempFileInTempDirDir = CreateTempDir("goo"); < CreateTempFile(Path.Combine(tempFileInTempDirDir, "ha.he")); < } --- > > tempDir1 = CreateTempDir("a.b"); > tempDir2 = CreateTempDir(Path.Combine(tempDir1, "foo")); > tempDir3 = CreateTempDir(Path.Combine(tempDir1, "goo")); > tempDir4 = CreateTempDir(Path.Combine(tempDir1, > Path.Combine(tempDir3, "x"))); > > tempFile1 = CreateTempFile(Path.Combine(tempDir1, "a.bb")); > tempFile2 = CreateTempFile(Path.Combine(tempDir1, "a.bc")); > tempFile3 = CreateTempFile(Path.Combine(tempDir2, "x.x")); > tempFile4 = CreateTempFile(Path.Combine(tempDir4, "y.y")); > tempFile5 = CreateTempFile(Path.Combine(tempDir3, "ha.he")); > tempFile6 = CreateTempFile(Path.Combine(tempDir3, "ha.he2")); > tempFile7 = CreateTempFile(Path.Combine(tempDir3, "ha.he3")); > > File.SetAttributes(tempDir2, FileAttributes.ReadOnly); > File.SetAttributes(tempDir3, FileAttributes.ReadOnly); > File.SetAttributes(Path.Combine(tempDir3, "ha.he3"), > FileAttributes.ReadOnly); > File.SetAttributes(Path.Combine(tempDir3, "ha.he2"), > FileAttributes.ReadOnly); > } 67,69c100 < Assertion.Assert("File should have been created:" + tempFile, File.Exists(tempFile)); < Assertion.Assert("Dir should have been created:" + tempDir, Directory.Exists(tempDir)); < Assertion.Assert("Dir should have been created:" + tempFileInTempDirDir, Directory.Exists(tempFileInTempDirDir)); --- > string result; 71c102,115 < string result = RunBuild(String.Format(CultureInfo.InvariantCulture, _xmlProjectTemplate, tempFile, tempDir, tempFileInTempDirDir)); --- > Assertion.Assert("File should have been created:" + tempFile1, > File.Exists(tempFile1)); > Assertion.Assert("File should have been created:" + tempFile2, > File.Exists(tempFile2)); > Assertion.Assert("File should have been created:" + tempFile3, > File.Exists(tempFile3)); > Assertion.Assert("File should have been created:" + tempFile4, > File.Exists(tempFile4)); > Assertion.Assert("File should have been created:" + tempFile5, > File.Exists(tempFile5)); > Assertion.Assert("File should have been created:" + tempFile6, > File.Exists(tempFile6)); > Assertion.Assert("File should have been created:" + tempFile7, > File.Exists(tempFile7)); > > Assertion.Assert("Dir should have been created:" + tempDir1, > Directory.Exists(tempDir1)); > Assertion.Assert("Dir should have been created:" + tempDir2, > Directory.Exists(tempDir2)); > Assertion.Assert("Dir should have been created:" + tempDir3, > Directory.Exists(tempDir3)); > Assertion.Assert("Dir should have been created:" + tempDir4, > Directory.Exists(tempDir4)); > > result = RunBuild(String.Format(CultureInfo.InvariantCulture, > _xmlProjectTemplate, "file", tempFile6 )); 73,76c117,174 < Assertion.Assert("File should have been deleted:" + result, !File.Exists(tempFile)); < Assertion.Assert("Dir should have been deleted:" + result, !Directory.Exists(tempDir)); < Assertion.Assert("Dir should have been deleted:" + result, !Directory.Exists(tempFileInTempDirDir)); < } --- > Assertion.Assert("File should not have been deleted:" + > tempFile1, File.Exists(tempFile1)); > Assertion.Assert("File should not have been deleted:" + > tempFile2, File.Exists(tempFile2)); > Assertion.Assert("File should not have been deleted:" + > tempFile3, File.Exists(tempFile3)); > Assertion.Assert("File should not have been deleted:" + > tempFile4, File.Exists(tempFile4)); > Assertion.Assert("File should not have been deleted:" + > tempFile5, File.Exists(tempFile5)); > Assertion.Assert("File should have been deleted:" + tempFile6, > !File.Exists(tempFile6)); > Assertion.Assert("File should not have been deleted:" + > tempFile7, File.Exists(tempFile7)); > > Assertion.Assert("Dir should not have been deleted:" + > tempDir1, Directory.Exists(tempDir1)); > Assertion.Assert("Dir should not have been deleted:" + > tempDir2, Directory.Exists(tempDir2)); > Assertion.Assert("Dir should not have been deleted:" + > tempDir3, Directory.Exists(tempDir3)); > Assertion.Assert("Dir should not have been deleted:" + > tempDir4, Directory.Exists(tempDir4)); > > result = RunBuild(String.Format(CultureInfo.InvariantCulture, > _xmlProjectTemplate, "dir", tempDir2 )); > > Assertion.Assert("File should not have been deleted:" + > tempFile1, File.Exists(tempFile1)); > Assertion.Assert("File should not have been deleted:" + > tempFile2, File.Exists(tempFile2)); > Assertion.Assert("File should have been deleted:" + tempFile3, > !File.Exists(tempFile3)); > Assertion.Assert("File should not have been deleted:" + > tempFile4, File.Exists(tempFile4)); > Assertion.Assert("File should not have been deleted:" + > tempFile5, File.Exists(tempFile5)); > Assertion.Assert("File should have been deleted:" + tempFile6, > !File.Exists(tempFile6)); > Assertion.Assert("File should not have been deleted:" + > tempFile7, File.Exists(tempFile7)); > > Assertion.Assert("Dir should not have been deleted:" + > tempDir1, Directory.Exists(tempDir1)); > Assertion.Assert("Dir should have been deleted:" + tempDir2, > !Directory.Exists(tempDir2)); > Assertion.Assert("Dir should not have been deleted:" + > tempDir3, Directory.Exists(tempDir3)); > Assertion.Assert("Dir should not have been deleted:" + > tempDir4, Directory.Exists(tempDir4)); > > result = RunBuild(String.Format(CultureInfo.InvariantCulture, > _xmlProjectTemplate, "file", tempFile1 )); > > Assertion.Assert("File should have been deleted:" + tempFile1, > !File.Exists(tempFile1)); > Assertion.Assert("File should not have been deleted:" + > tempFile2, File.Exists(tempFile2)); > Assertion.Assert("File should have been deleted:" + tempFile3, > !File.Exists(tempFile3)); > Assertion.Assert("File should not have been deleted:" + > tempFile4, File.Exists(tempFile4)); > Assertion.Assert("File should not have been deleted:" + > tempFile5, File.Exists(tempFile5)); > Assertion.Assert("File should have been deleted:" + tempFile6, > !File.Exists(tempFile6)); > Assertion.Assert("File should not have been deleted:" + > tempFile7, File.Exists(tempFile7)); > > Assertion.Assert("Dir should not have been deleted:" + > tempDir1, Directory.Exists(tempDir1)); > Assertion.Assert("Dir should have been deleted:" + tempDir2, > !Directory.Exists(tempDir2)); > Assertion.Assert("Dir should not have been deleted:" + > tempDir3, Directory.Exists(tempDir3)); > Assertion.Assert("Dir should not have been deleted:" + > tempDir4, Directory.Exists(tempDir4)); > > result = RunBuild(String.Format(CultureInfo.InvariantCulture, > _xmlProjectTemplate2, tempDir1 )); > > Assertion.Assert("File should have been deleted:" + tempFile1, > !File.Exists(tempFile1)); > Assertion.Assert("File should have been deleted:" + tempFile2, > !File.Exists(tempFile2)); > Assertion.Assert("File should have been deleted:" + tempFile3, > !File.Exists(tempFile3)); > Assertion.Assert("File should have been deleted:" + tempFile4, > !File.Exists(tempFile4)); > Assertion.Assert("File should have been deleted:" + tempFile5, > !File.Exists(tempFile5)); > Assertion.Assert("File should have been deleted:" + tempFile6, > !File.Exists(tempFile6)); > Assertion.Assert("File should have been deleted:" + tempFile7, > !File.Exists(tempFile7)); > > Assertion.Assert("Dir should have been deleted:" + tempDir1, > !Directory.Exists(tempDir1)); > Assertion.Assert("Dir should have been deleted:" + tempDir2, > !Directory.Exists(tempDir2)); > Assertion.Assert("Dir should have been deleted:" + tempDir3, > !Directory.Exists(tempDir3)); > Assertion.Assert("Dir should have been deleted:" + tempDir4, > !Directory.Exists(tempDir4)); > }