/// <summary> /// fetch yaml header from repo repo and parse it /// </summary> /// <param name="repoName">The name of each repo</param> /// <returns> The yaml header. </returns> internal async Task <YamlHeader> GetYamlHeader(string repoName, string branch) { //downloading the yaml file var gitHubOrg = _config.GetValue <string>("GitHubOrganization"); var httpClient = _clientFactory.CreateClient(); return(await YamlHeader.GetFromRepo(httpClient, gitHubOrg, repoName, branch)); }
public async Task ShouldGetHeaderFromRepo() { // Arrange var organization = "microsoftgraph"; var repoName = "msgraph-sdk-java"; var branch = "dev"; // Act var header = await YamlHeader.GetFromRepo(_httpClient, organization, repoName, branch); // Assert Assert.NotNull(header); }
public async Task ShouldCombineMultipleSources() { // Arrange var readmeHeader = @"--- languages: - java extensions: services: - Outlook - OneDrive - Teams --- # README TITLE Some text"; var repoNameHeader = @" extensions: services: - Outlook - OneDrive dependencyFile: demo/GraphTutorial/app/build.gradle"; var devxHeader = @" dependencyFile: demo/GraphTutorial/app/dependencies.gradle"; var contentHandler = new StringContentHandler(new string[] { readmeHeader, repoNameHeader, devxHeader }); var httpClient = new HttpClient(contentHandler); // Act // Using placholder values here since the HTTP request are mocked var header = await YamlHeader.GetFromRepo(httpClient, "organization", "repo", "branch"); // Assert Assert.Single(header.Languages); Assert.Contains("java", header.Languages); Assert.NotNull(header.Extensions); Assert.NotNull(header.Extensions.Services); Assert.Equal(2, header.Extensions.Services.Length); Assert.Contains("Outlook", header.Extensions.Services); Assert.DoesNotContain("Teams", header.Extensions.Services); Assert.NotNull(header.DependencyFile); Assert.Equal("demo/GraphTutorial/app/dependencies.gradle", header.DependencyFile); Assert.False(header.NoDependencies); }