public void WhenCloning_ThrowAnArgumentExceptionWhen_UrlIsEmpty(string url) { var configMock = NSubstitute.Substitute.For <GitConfigurationProvider>(null, null); GitRepositoryProvider provider = new GitRepositoryProvider(configMock); Assert.Throws <ArgumentNullException>(() => provider.Clone("somePath", url)); }
public new void SetUp() { const string gitDirectory = "__git__"; _gitDirectory = SolutionItemsBasePath.Combine(gitDirectory); _gitRepositoryProvider = new TestGitRepositoryProvider(gitDirectory); _gitDirectory.CreateDirectory(); }
public new void SetUp() { _solutionPathProvider = new FixedSolutionPathProvider(TestDataPath2.Parent.Parent.Parent); _gitRepositoryProvider = new TestGitRepositoryProvider(); _gitDirectoryPath = TestDataPath2.Parent.Combine(_gitRepositoryProvider.GitDirectoryName); _gitDirectoryPath.CreateDirectory(); _gitDirectoryPath.Combine("config").WriteAllText("https://repository.url/"); _gitDirectoryPath.Combine("HEAD").WriteAllText("my_branch"); }
/// <summary> /// Create a Solution by cloning a remote git repository. /// </summary> /// <param name="githubUrl"> /// The url to the code to create the solution from. /// Can be a .cs, .csproj or .sln file. /// Sample URL: https://github.com/GuOrg/Gu.Roslyn.Asserts/blob/master/Gu.Roslyn.Asserts.sln. /// </param> /// <param name="analyzers">The analyzers to add diagnostic options for.</param> /// <param name="metadataReferences">The metadata references.</param> /// <returns>>A <see cref="Solution"/>.</returns> public static Solution CreateSolution(Uri githubUrl, IReadOnlyList <DiagnosticAnalyzer> analyzers, IEnumerable <MetadataReference> metadataReferences = null) { var git = new GitClient(); var gitFile = GitRepositoryProvider.ParseUrl(githubUrl); string tempDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); var directoryInfo = Directory.CreateDirectory(tempDirectory); git.Clone( gitFile.RepositoryUrl, directoryInfo.FullName, GitClient.CloneFlags.Shallow, gitFile.Branch); var slnFileInfo = new FileInfo(Path.Combine(directoryInfo.FullName, gitFile.Path)); return(CreateSolution(slnFileInfo, analyzers, metadataReferences)); }
public CustomSourceLinkFqnProvider(ISolution solution, SolutionPathProvider solutionPathProvider, GitRepositoryProvider gitRepositoryProvider) { _solution = solution; _solutionPathProvider = solutionPathProvider; _gitRepositoryProvider = gitRepositoryProvider; }
public GetBranchNameMacroImplementation(GitRepositoryProvider gitRepositoryProvider, MacroParameterValueCollection parameters = null) { _gitRepositoryProvider = gitRepositoryProvider; _stripingRegexParameter = parameters.OptionalFirstOrDefault(); }
public RemoteController(GitRepositoryProvider repositoryProvider) { _repositoryProvider = repositoryProvider; }