public void TestFilenameDeDuplication() { var paths = new List <string> { @"c:\blie\bla.txt", @"c:\bla\bla.txt", @"c:\blie\bla.txt", @"c:\yadi.json", @"c:\blie\bit.xml", @"c:\blie\bit.json", @"c:\blie\bit.txt" }; var res = DirectorySource.ResolveDuplicateFilenames(paths, DirectorySource.DuplicateFilenameResolution.PreferXml); Assert.AreEqual(5, res.Count); Assert.IsTrue(res.Any(p => p.EndsWith("bit.xml"))); Assert.IsTrue(res.Any(p => p.EndsWith("bit.txt"))); Assert.IsFalse(res.Any(p => p.EndsWith("bit.json"))); Assert.IsTrue(res.Any(p => p.EndsWith("yadi.json"))); res = DirectorySource.ResolveDuplicateFilenames(paths, DirectorySource.DuplicateFilenameResolution.PreferJson); Assert.AreEqual(5, res.Count); Assert.IsFalse(res.Any(p => p.EndsWith("bit.xml"))); Assert.IsTrue(res.Any(p => p.EndsWith("bit.txt"))); Assert.IsTrue(res.Any(p => p.EndsWith("bit.json"))); Assert.IsTrue(res.Any(p => p.EndsWith("yadi.json"))); res = DirectorySource.ResolveDuplicateFilenames(paths, DirectorySource.DuplicateFilenameResolution.KeepBoth); Assert.AreEqual(6, res.Count); Assert.IsTrue(res.Any(p => p.EndsWith("bit.xml"))); Assert.IsTrue(res.Any(p => p.EndsWith("bit.json"))); }