Example #1
0
            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
                                                                              ));
            }
Example #2
0
            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)
                                                                              ));
            }
Example #3
0
            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
                                                                              ));
            }
Example #4
0
 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;
 }
Example #5
0
 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;
 }
Example #6
0
 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;
 }
Example #7
0
 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;
 }