public async Task NotifyPending_ShouldSendARequest_WithPendingDescription() { var logger = Substitute.For <ILogger <GithubStatusNotifier> >(); var httpClient = Substitute.For <GithubHttpClient>(options); var fetcher = new GithubStatusNotifier(httpClient, options, logger); httpClient.SendAsync(Any <HttpRequestMessage>()).Returns(new HttpResponseMessage { StatusCode = OK }); await fetcher.NotifyPending(repoName, sha); await httpClient.Received().SendAsync(Is <HttpRequestMessage>(req => req.Json <CreateStatusRequest>().Description == expectedPendingDescription )); }
public async Task NotifyPending_ShouldSendARequest_ToTheCorrectUrl() { var logger = Substitute.For <ILogger <GithubStatusNotifier> >(); var httpClient = Substitute.For <GithubHttpClient>(options); var fetcher = new GithubStatusNotifier(httpClient, options, logger); httpClient.SendAsync(Any <HttpRequestMessage>()).Returns(new HttpResponseMessage { StatusCode = OK }); await fetcher.NotifyPending(repoName, sha); await httpClient.Received().SendAsync(Is <HttpRequestMessage>(req => req.RequestUri == new Uri(expectedUrl) )); }
public async Task NotifyPending_ShouldSendAPostRequest() { var logger = Substitute.For <ILogger <GithubStatusNotifier> >(); var httpClient = Substitute.For <GithubHttpClient>(options); var fetcher = new GithubStatusNotifier(httpClient, options, logger); httpClient.SendAsync(Any <HttpRequestMessage>()).Returns(new HttpResponseMessage { StatusCode = OK }); await fetcher.NotifyPending(repoName, sha); await httpClient.Received().SendAsync(Is <HttpRequestMessage>(req => req.Method == HttpMethod.Post )); }
public Handler( RequestValidator requestValidator, PipelineStarter pipelineStarter, PipelineDeployer pipelineDeployer, GithubStatusNotifier statusNotifier, GithubCommitMessageFetcher commitMessageFetcher, IOptions <Config> config, ILogger <Handler> logger ) { this.requestValidator = requestValidator; this.pipelineStarter = pipelineStarter; this.pipelineDeployer = pipelineDeployer; this.statusNotifier = statusNotifier; this.commitMessageFetcher = commitMessageFetcher; this.config = config.Value; this.logger = logger; }
public PipelineDeployer( IAmazonS3 s3Client, Sha256SumComputer sumComputer, GithubFileFetcher fileFetcher, GithubStatusNotifier statusNotifier, DeployStackFacade stackDeployer, IOptions <Config> options, ILogger <PipelineDeployer> logger ) { this.s3Client = s3Client; this.config = options.Value; this.sumComputer = sumComputer; this.fileFetcher = fileFetcher; this.statusNotifier = statusNotifier; this.stackDeployer = stackDeployer; this.logger = logger; }
public Handler( StackDeploymentStatusRequestFactory requestFactory, IAmazonStepFunctions stepFunctionsClient, IAmazonSQS sqsClient, IAwsFactory <IAmazonCloudFormation> cloudformationFactory, GithubStatusNotifier githubStatusNotifier, TokenInfoRepository tokenInfoRepository, IOptions <Config> config, ILogger <Handler> logger ) { this.requestFactory = requestFactory; this.stepFunctionsClient = stepFunctionsClient; this.sqsClient = sqsClient; this.cloudformationFactory = cloudformationFactory; this.tokenInfoRepository = tokenInfoRepository; this.githubStatusNotifier = githubStatusNotifier; this.config = config.Value; this.logger = logger; }
public Handler( DeployStackFacade stackDeployer, S3Util s3Util, ParseConfigFileFacade parseConfigFileFacade, TokenGenerator tokenGenerator, RequestFactory requestFactory, IAmazonStepFunctions stepFunctionsClient, IAwsFactory <IAmazonCloudFormation> cloudformationFactory, GithubStatusNotifier statusNotifier, IOptions <Config> config ) { this.stackDeployer = stackDeployer; this.s3Util = s3Util; this.parseConfigFileFacade = parseConfigFileFacade; this.tokenGenerator = tokenGenerator; this.requestFactory = requestFactory; this.stepFunctionsClient = stepFunctionsClient; this.cloudformationFactory = cloudformationFactory; this.statusNotifier = statusNotifier; this.config = config.Value; }