public virtual void TestAddDeleteTrickyNames() { DirCache dc = DirCache.NewInCore(); DirCacheEditor editor = dc.Editor(); editor.Add(new DirCachePathEditTest.AddEdit("a/b")); editor.Add(new DirCachePathEditTest.AddEdit("a.")); editor.Add(new DirCachePathEditTest.AddEdit("ab")); editor.Finish(); NUnit.Framework.Assert.AreEqual(3, dc.GetEntryCount()); // Validate sort order NUnit.Framework.Assert.AreEqual("a.", dc.GetEntry(0).PathString); NUnit.Framework.Assert.AreEqual("a/b", dc.GetEntry(1).PathString); NUnit.Framework.Assert.AreEqual("ab", dc.GetEntry(2).PathString); editor = dc.Editor(); // Sort order should not confuse DeleteTree editor.Add(new DirCacheEditor.DeleteTree("a")); editor.Finish(); NUnit.Framework.Assert.AreEqual(2, dc.GetEntryCount()); NUnit.Framework.Assert.AreEqual("a.", dc.GetEntry(0).PathString); NUnit.Framework.Assert.AreEqual("ab", dc.GetEntry(1).PathString); }
public virtual void TestAddDeletePathAndTreeNormalNames() { DirCache dc = DirCache.NewInCore(); DirCacheEditor editor = dc.Editor(); editor.Add(new DirCachePathEditTest.AddEdit("a")); editor.Add(new DirCachePathEditTest.AddEdit("b/c")); editor.Add(new DirCachePathEditTest.AddEdit("c/d")); editor.Finish(); NUnit.Framework.Assert.AreEqual(3, dc.GetEntryCount()); NUnit.Framework.Assert.AreEqual("a", dc.GetEntry(0).PathString); NUnit.Framework.Assert.AreEqual("b/c", dc.GetEntry(1).PathString); NUnit.Framework.Assert.AreEqual("c/d", dc.GetEntry(2).PathString); editor = dc.Editor(); editor.Add(new DirCacheEditor.DeletePath("b/c")); editor.Finish(); NUnit.Framework.Assert.AreEqual(2, dc.GetEntryCount()); NUnit.Framework.Assert.AreEqual("a", dc.GetEntry(0).PathString); NUnit.Framework.Assert.AreEqual("c/d", dc.GetEntry(1).PathString); editor = dc.Editor(); editor.Add(new DirCacheEditor.DeleteTree(string.Empty)); editor.Finish(); NUnit.Framework.Assert.AreEqual(0, dc.GetEntryCount()); }