public void MergeHooksDataEmptyConfig() { string result = HooksInstallHelper.MergeHooksData(new string[] { }, Filename, GVFSConstants.DotGit.Hooks.PreCommandHookName); IEnumerable <string> resultLines = result .Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries) .Where(line => !line.StartsWith("#")); resultLines.Single().ShouldEqual(GVFSConstants.GVFSHooksExecutableName); }
public void MergeHooksDataDiscardBlankLines() { string result = HooksInstallHelper.MergeHooksData(new string[] { "first", "second", string.Empty, " " }, Filename, GVFSConstants.DotGit.Hooks.PreCommandHookName); IEnumerable <string> resultLines = result .Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries) .Where(line => !line.StartsWith("#")); resultLines.Count().ShouldEqual(3); resultLines.ElementAt(0).ShouldEqual("first"); resultLines.ElementAt(1).ShouldEqual("second"); resultLines.ElementAt(2).ShouldEqual(GVFSConstants.GVFSHooksExecutableName); }
public void MergeHooksDataThrowsOnFoundGVFSHooks() { Assert.Throws <HooksInstallHelper.HooksConfigurationException>( () => HooksInstallHelper.MergeHooksData(new string[] { "first", "gvfs.hooks.exe" }, Filename, GVFSConstants.DotGit.Hooks.PreCommandHookName)); }