public void Identify_RepositoryOverHttp_ReturnsRevSpec() { IdentifyCommand cmd = new IdentifyCommand().WithPath("https://hg01.codeplex.com/mercurialnet"); NonPersistentClient.Execute(cmd); Assert.That(cmd.Result, Is.Not.Null); }
public void GetHelpText_ForLogCommand_ReturnsText() { var command = new HelpCommand { Topic = "log" }; NonPersistentClient.Execute(command); string text = command.Result; Assert.That(text, Is.StringContaining("show revision history of entire repository or files")); }
public void GetHelpText_WithoutGlobalOptions_DoesNotIncludeGlobalOptions() { var command = new HelpCommand { Topic = "log" }; NonPersistentClient.Execute(command); string text = command.Result; Assert.That(text, Is.Not.StringContaining("enable debugging output")); }
public void GetHelpText_WithGlobalOptions_IncludesGlobalOptions() { var command = new HelpCommand { Topic = "log", IncludeGlobalHelp = true }; NonPersistentClient.Execute(command); string text = command.Result; Assert.That(text, Contains.Substring("enable debugging output")); }
protected override void OnCheckConnection(PluginProfileErrorCollection errors, MercurialPluginProfile settings) { settings.ValidateUri(errors); if (!errors.Any()) { var identifyCommand = new IdentifyCommand().WithPath(settings.Uri).WithTimeout(20); NonPersistentClient.Execute(identifyCommand); if (identifyCommand.RawExitCode != 0) { throw new Exception("Can't establish connection"); } } }
public void Identify_WebSiteThatIsntRepository_ThrowsMercurialExecutionException() { try { new WebClient().DownloadString("http://localhost"); } catch (WebException) { Assert.Inconclusive("No web server set up locally, test not executed"); return; } IdentifyCommand cmd = new IdentifyCommand().WithPath("http://localhost"); Assert.Throws <MercurialExecutionException>(() => NonPersistentClient.Execute(cmd)); }
/// <summary> /// Refreshes the client configuration information by calling the Mercurial command line /// client and asking it to report the current configuration. /// </summary> public void Refresh() { lock (_Configuration) { _Configuration.Clear(); var command = new ShowConfigCommand(); NonPersistentClient.Execute(command); foreach (ConfigurationEntry entry in command.Result.ToArray()) { Dictionary <string, string> section; if (!_Configuration.TryGetValue(entry.Section, out section)) { section = new Dictionary <string, string>(); _Configuration[entry.Section] = section; } section[entry.Name] = entry.Value; } } }
/// <summary> /// Refreshes the client configuration information by calling the Mercurial command line /// client and asking it to report the current configuration. /// </summary> /// <param name="currentWorkingDirectory">Path to repo passed through --cwd param to Mercurial</param> public void Refresh(string currentWorkingDirectory = null) { lock (_Configuration) { _Configuration.Clear(); var command = new ShowConfigCommand(); if (currentWorkingDirectory != null) { command.AddArgument($"--cwd {currentWorkingDirectory}"); } NonPersistentClient.Execute(command); foreach (ConfigurationEntry entry in command.Result.ToArray()) { Dictionary <string, string> section; if (!_Configuration.TryGetValue(entry.Section, out section)) { section = new Dictionary <string, string>(); _Configuration[entry.Section] = section; } section[entry.Name] = entry.Value; } } }
public void Identify_WebSiteThatDoesNotExist_ThrowsMercurialExecutionException() { IdentifyCommand cmd = new IdentifyCommand().WithPath("http://localhostxyzklm"); Assert.Throws <MercurialExecutionException>(() => NonPersistentClient.Execute(cmd)); }
public void Execute_NullCommand_ThrowsArgumentNullException() { IMercurialCommand command = null; Assert.Throws <ArgumentNullException>(() => NonPersistentClient.Execute(command)); }
public void Execute_NullOrEmptyRepositoryPath_ThrowsArgumentNullException(string input) { var command = new DummyCommand(); Assert.Throws <ArgumentNullException>(() => NonPersistentClient.Execute(input, command)); }