public void Deve_retornar_falso_quando_githubresponse_result_preenchido() { var item = new GitHubResult() { Language = "C#", Owner = new OwnerResult(), Html_Url = "https://api.github.com/users/octocat", Name = "octocat", Description = "", Full_Name = "", Id = 1, Pushed_At = "", Created_At = "", Updated_At = "", Node_Id = "MDQ6VXNlcjE=" }; var result = new GitHubResponseResult() { Items = new List <GitHubResult>() { item }, Incomplete_Result = false, Total_Count = 1 }; result.Validar(); Assert.IsFalse(result.Notifications.Any()); }
public void Deve_retornar_verdadeiro_quando_github_result_nao_preenchido() { var result = new GitHubResult(); result.Validar(); Assert.IsTrue(result.Notifications.Any()); }
public void Deve_retornar_falso_quando_github_result_preenchido() { var result = new GitHubResult() { Id = 1, Node_Id = "123", Created_At = "2019-07-16", Pushed_At = "2019-07-16", Updated_At = "2019-07-16", Description = "Teste", Name = "Guilherme", Full_Name = "Guilherme Lopes", Html_Url = "https://github.com/guiilopes/", Language = "CSharp", Owner = new OwnerResult() }; result.Validar(); Assert.IsFalse(result.Notifications.Any()); }
private async Task PrintRepositoryInformationAsync() { var result = new GitHubResult(); var getBytes = await _httpHandler .GetBytesAsync("https://api.github.com/repos/Yucked/Frostbyte").ConfigureAwait(false); result.Repo = JsonSerializer.Parse <GitHubRepo>(getBytes.Span); getBytes = await _httpHandler .WithUrl("https://api.github.com/repos/Yucked/Frostbyte/commits") .GetBytesAsync().ConfigureAwait(false); result.Commit = JsonSerializer.Parse <IEnumerable <GitHubCommit> >(getBytes.Span).FirstOrDefault(); Console.WriteLineFormatted( $" {{0}}: {result.Repo.OpenIssues} opened | {{1}}: {result.Repo.License.Name} | {{2}}: {result.Commit?.Sha}", Color.White, new Formatter("Issues", Color.Plum), new Formatter("License", Color.Plum), new Formatter("SHA", Color.Plum)); }