예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
 public void MergeHooksDataThrowsOnFoundGVFSHooks()
 {
     Assert.Throws <HooksInstallHelper.HooksConfigurationException>(
         () => HooksInstallHelper.MergeHooksData(new string[] { "first", "gvfs.hooks.exe" }, Filename, GVFSConstants.DotGit.Hooks.PreCommandHookName));
 }