public void WritesAfterLoad() { string alwaysExcludeFilePath = Path.Combine(this.Repo.GitParentPath, GVFS.Common.GVFSConstants.DotGit.Info.AlwaysExcludeName); AlwaysExcludeFile alwaysExcludeFile = new AlwaysExcludeFile(this.Repo.Context, alwaysExcludeFilePath); this.Repo.Context.FileSystem.FileExists(alwaysExcludeFilePath).ShouldEqual(false); alwaysExcludeFile.LoadOrCreate(); this.Repo.Context.FileSystem.FileExists(alwaysExcludeFilePath).ShouldEqual(true); alwaysExcludeFile.AddEntriesForFile("a\\1.txt"); alwaysExcludeFile.AddEntriesForFile("a\\2.txt"); List <string> expectedContents = new List <string>() { "*", "!/a/", "!/a/1.txt", "!/a/2.txt" }; this.CheckFileContents(alwaysExcludeFilePath, expectedContents); alwaysExcludeFile = new AlwaysExcludeFile(this.Repo.Context, alwaysExcludeFilePath); alwaysExcludeFile.LoadOrCreate(); alwaysExcludeFile.AddEntriesForFile("a\\3.txt"); expectedContents = new List <string>() { "*", "!/a/", "!/a/1.txt", "!/a/2.txt", "!/a/3.txt" }; this.CheckFileContents(alwaysExcludeFilePath, expectedContents); }
public void RemovesEntriesWithDifferentCase() { string alwaysExcludeFilePath = Path.Combine(this.Repo.GitParentPath, GVFS.Common.GVFSConstants.DotGit.Info.AlwaysExcludeName); AlwaysExcludeFile alwaysExcludeFile = new AlwaysExcludeFile(this.Repo.Context, alwaysExcludeFilePath); this.Repo.Context.FileSystem.FileExists(alwaysExcludeFilePath).ShouldEqual(false); alwaysExcludeFile.LoadOrCreate(); this.Repo.Context.FileSystem.FileExists(alwaysExcludeFilePath).ShouldEqual(true); alwaysExcludeFile.AddEntriesForFile("a\\x.txt"); alwaysExcludeFile.AddEntriesForFile("A\\y.txt"); alwaysExcludeFile.AddEntriesForFile("a\\Z.txt"); alwaysExcludeFile.RemoveEntriesForFiles(new List <string> { "a\\y.txt", "a\\z.txt" }); alwaysExcludeFile.FlushAndClose(); List <string> expectedContents = new List <string>() { "*", "!/a/", "!/a/x.txt" }; this.CheckFileContents(alwaysExcludeFilePath, expectedContents); }