public static void Init() { DriverFactory = new WebDriverFactory(); Asserter = new WebAssert(); Timeouts = new WebTimeoutSettings(); Logger = new NUnitLogger(); MapInterfaceToElement.Init(DefaultInterfacesMap); }
public void GitHubClientTests_SetUp() { //var services = new ServiceCollection(); OctoKitPullRequestReviewsClient = new Mock <IPullRequestReviewsClient>(); OctoKitPullRequestsClient = new Mock <IPullRequestsClient>(); OctoKitPullRequestsClient.SetupGet(x => x.Review).Returns(OctoKitPullRequestReviewsClient.Object); OctoKitRepositoriesClient = new Mock <IRepositoriesClient>(); OctoKitRepositoriesClient.SetupGet(x => x.PullRequest).Returns(OctoKitPullRequestsClient.Object); OctoKitGithubClient = new Mock <IGitHubClient>(); OctoKitGithubClient.SetupGet(x => x.Repository).Returns(OctoKitRepositoriesClient.Object); NUnitLogger nUnitLogger = new NUnitLogger(); GitHubClientForTest = new TestGitHubClient("git", "fake-token", nUnitLogger, "fake-path", null); GitHubClientForTest.SetGitHubClientObject(OctoKitGithubClient.Object); }
protected TestBase() { var scope = Environment.GetEnvironmentVariable("scope"); var access = Environment.GetEnvironmentVariable("access_token"); var refresh = Environment.GetEnvironmentVariable("refresh_token"); var name = Environment.GetEnvironmentVariable("name"); var clientId = Environment.GetEnvironmentVariable("client_id"); var clientSecret = Environment.GetEnvironmentVariable("client_secret"); UserId = Convert.ToInt64(Environment.GetEnvironmentVariable("userId")); Token = new AccessToken { Access_Token = access, RefreshToken = refresh, Scope = scope }; var logger = new NUnitLogger <TestBase>(); Client = new ShikimoriClient(logger, new ClientSettings(name, clientId, clientSecret)); }
private async Task <int> GetAzDoPullRequestIdAsync(string targetRepoName, string targetBranch) { string searchBaseUrl = GetAzDoRepoUrl(targetRepoName); string apiBaseUrl = GetAzDoApiRepoUrl(targetRepoName); IEnumerable <int> prs = new List <int>(); int attempts = 10; while (attempts-- > 0) { try { prs = await SearchPullRequestsAsync(searchBaseUrl, targetBranch).ConfigureAwait(false); } catch (HttpRequestException ex) { // Returning a 404 is expected before the PR has been created NUnitLogger logger = new NUnitLogger(); logger.LogInformation($"Searching for AzDo pull requests returned an error: {ex.Message}"); } if (prs.Count() == 1) { return(prs.FirstOrDefault()); } if (prs.Count() > 1) { throw new MaestroTestException($"More than one pull request found in {targetRepoName} targeting {targetBranch}"); } await Task.Delay(60 * 1000).ConfigureAwait(false); } throw new MaestroTestException($"No pull request was created in {searchBaseUrl} targeting {targetBranch}"); }
public static ILogger <T> Create <T>() { var logger = new NUnitLogger <T>(); return(logger); }
public static ILogger Create() { var logger = new NUnitLogger <TestLogger>(); return(logger); }
public static ILogger Create <T>(string categoryName = "") { var logger = new NUnitLogger <T>(categoryName); return(logger); }