Strypper / mauisland

MAUIsland 🏝️ is the number 1 controls gallery for .NET MAUI
MIT License
199 stars 14 forks source link

🚀 GitHub Provider Integration Tests #182

Closed Strypper closed 5 months ago

Strypper commented 8 months ago

Description

The GitHub Service offers a comprehensive suite of functionalities to access repository information, issues, GitHub authors, and more. Currently, the service supports the following operations (with additional functionalities planned for future releases):

IGitHubService


namespace MAUIsland.GitHubProvider;

public interface IGitHubService
{
    Task<GitHubRepositoryModel> GetRepository(string owner, string repository);

    Task<GitHubAuthorModel> GetAuthor(string owner);

    Task<IEnumerable<GitHubIssueModel>> GetGitHubIssues(string owner, string repository);

    Task<IEnumerable<GitHubIssueModel>> GetGitHubIssuesByLabels(string owner, string repository, IEnumerable<string> labels);

    Task<GitHubIssueModel> GetGitHubIssueById(string owner, string repository, string issueNumber);
}

To ensure the integrity of future implementations of the IGitHubService interface, comprehensive integration tests have been developed in the GitHubServiceIntegrationTest class. These tests cover all defined methods, verifying that each method functions correctly under various scenarios. Running these tests against new implementations of IGitHubService ensures consistent behavior across different implementations.

How do you ensure the GitHub data is unchanged to prevent break the test assertions?

The targeted repository will be this all the issues, repository, and author information will remain unchanged for 2 months so the assertions will be enough for this spring

Public API Changes


namespace MAUIsland.GitHubProvider;

public interface IGitHubService
{
    Task<GitHubRepositoryModel> GetRepository(string owner, string repository);

    Task<GitHubAuthorModel> GetAuthor(string owner);

    Task<IEnumerable<GitHubIssueModel>> GetGitHubIssues(string owner, string repository);

    Task<IEnumerable<GitHubIssueModel>> GetGitHubIssuesByLabels(string owner, string repository, IEnumerable<string> labels);

    Task<GitHubIssueModel> GetGitHubIssueById(string owner, string repository, string issueNumber);
}

Intended Use-Case

Test whenever we have GitHub API implementation changes

Strypper commented 5 months ago

Implemented