public void TestGetFilesNoTargetPath() { EmbedFolder embedFolder = new EmbedFolder(); embedFolder.sourcefolderpath = Path.Combine(Environment.GetFolderPath( Environment.SpecialFolder.System), @"spool\tools"); string supportdir = @"C:\SupportFiles\SupportFolder"; Dictionary <string, EmbedFileCollection> embedFileCollection = embedFolder.GetFiles(string.Empty, supportdir); foreach (EmbedFilePair pair in embedFileCollection[string.Empty]) { Console.WriteLine("{0} -> {1}", pair.fullpath, pair.relativepath); Assert.IsFalse(pair.relativepath.StartsWith(@"\")); Assert.IsTrue(File.Exists(pair.fullpath)); } }
public void TestGetFilesTargetWithBackslashPath2() { EmbedFolder embedFolder = new EmbedFolder(); embedFolder.sourcefolderpath = Path.Combine(Environment.GetFolderPath( Environment.SpecialFolder.System), @"spool\tools"); embedFolder.targetfolderpath = @"\parent\child\"; string supportdir = @"C:\SupportFiles\SupportFolder"; Dictionary <string, EmbedFileCollection> embedFileCollection = embedFolder.GetFiles(string.Empty, supportdir); foreach (EmbedFilePair pair in embedFileCollection[string.Empty]) { Console.WriteLine("{0} -> {1}", pair.fullpath, pair.relativepath); Assert.IsFalse(pair.relativepath.StartsWith(@"\")); Assert.IsTrue(File.Exists(pair.fullpath)); Assert.IsTrue(pair.relativepath.StartsWith(embedFolder.targetfolderpath.TrimStart(Path.DirectorySeparatorChar))); Assert.IsFalse(pair.relativepath.Contains(@"\\")); } }