private static Services GetServices(ExecutionContext context) { if (_services != null) { return(_services); } var configuration = new ConfigurationBuilder() .SetBasePath(context.FunctionAppDirectory) .AddJsonFile("local.settings.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables() .Build(); var options = Options.Create(configuration.GetSection("Github").Get <GithubSettings>()); var githubConnectionCache = new GithubConnectionCache(new GithubAppTokenService(options)); var pullRequestHandler = new PullRequestHandler( new PullRequestInfoProvider(), new RepositorySettingsProvider(), new WorkInProgressPullRequestPolicy(), new CommitStatusWriter(options)); var payloadValidator = new GithubPayloadValidator(options); return(_services = new Services(configuration, options, githubConnectionCache, pullRequestHandler, payloadValidator)); }
public Services(IConfigurationRoot configuration, IOptions <GithubSettings> options, GithubConnectionCache githubConnectionCache, PullRequestHandler pullRequestHandler, GithubPayloadValidator payloadValidator) { Configuration = configuration; Options = options; GithubConnectionCache = githubConnectionCache; PullRequestHandler = pullRequestHandler; PayloadValidator = payloadValidator; }
public PayloadValidatorTests() { var options = Options.Create(new GithubSettings { WebhookSecret = "foobarbaz" }); _validator = new GithubPayloadValidator(options); }