public async Task StartExecutionIsCalled_ForPREvent() { var repoName = "name"; var sha = "sha"; var @ref = "ref"; var payload = new PullRequestEvent { PullRequest = new PullRequest { Head = new PullRequestHead { Sha = sha, Ref = @ref, } }, Repository = new Repository { Name = repoName } }; var serializedPayload = Serialize(payload); var stepFunctionsClient = Substitute.For <IAmazonStepFunctions>(); var logger = Substitute.For <ILogger <PipelineStarter> >(); var pipelineStarter = new PipelineStarter(stepFunctionsClient, logger); await pipelineStarter.StartPipelineIfExists(payload); var StateMachineArn = $"arn:aws:states:us-east-1:5:stateMachine:{repoName}-cicd-pipeline"; await stepFunctionsClient.Received().StartExecutionAsync(Arg.Is <StartExecutionRequest>(req => req.StateMachineArn == StateMachineArn && req.Name == sha && req.Input == serializedPayload )); }
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; }