public async Task ShouldGetRemotes() { var gitDiscoveryDriver = new GitCmdDiscoveryDriver(_pathTogit, _logger); var classicgitDiscoveryDriver = new LibGit2SharpDiscoveryDriver(_logger); var remotes = await gitDiscoveryDriver.GetRemotes(new Uri(_repoPath)); var classicRemotes = await classicgitDiscoveryDriver.GetRemotes(new Uri(_repoPath)); // Lib2Sharp and GitCmd should have the same results }
public async Task ShouldGetRemotes() { var gitDiscoveryDriver = new GitCmdDiscoveryDriver(_pathTogit, _logger); var classicGitDiscoveryDriver = new LibGit2SharpDiscoveryDriver(_logger); var remotes = await gitDiscoveryDriver.GetRemotes(new Uri(_repo.FullName)); var classicRemotes = await classicGitDiscoveryDriver.GetRemotes(new Uri(_repo.FullName)); var remotesArray = remotes?.ToArray(); var classicRemotesArray = classicRemotes?.ToArray(); Assert.IsNotNull(remotesArray, "GitCmdDiscoveryDriver returned null for GetRemotes"); Assert.IsNotNull(classicRemotesArray, "LibGit2SharpDiscoveryDriver returned null for GetRemotes"); Assert.AreEqual(remotesArray?.Length, classicRemotesArray?.Length, "Lib2Sharp and GitCmd should have the same number of results"); for (var count = 0; count < classicRemotesArray.Length; count++) { var classicRemote = classicRemotesArray[count]; var remote = remotesArray.Where(r => r.Name.Equals(classicRemote.Name, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault(); Assert.NotNull(classicRemote, $"GitCmd does not find remote {remote.Name}"); Assert.AreEqual(classicRemote.Url, remote.Url, $"GitCmd does return the same url: {remote.Url}"); } }