public async Task ShouldSendTaskSuccessWithSupersededTrueIfNewerCommitExists( string token, Request request, [Substitute] SQSEvent sqsEvent, [Frozen, Substitute] IAmazonStepFunctions stepFunctionsClient, [Frozen, Options] IOptions <Config> options, [Frozen, Substitute] RequestFactory requestFactory, [Frozen, Substitute] S3GetObjectFacade s3GetObjectFacade, [Target] Handler handler ) { request.Token = token; request.CommitTimestamp = DateTime.Now - TimeSpan.FromHours(1); requestFactory.CreateFromSqsEvent(Any <SQSEvent>()).Returns(request); s3GetObjectFacade.TryGetObject <StateInfo>(null, null).ReturnsForAnyArgs(new StateInfo { LastCommitTimestamp = DateTime.Now }); await handler.Handle(sqsEvent); var expectedOutput = Serialize(new { Superseded = true }); await stepFunctionsClient.Received().SendTaskSuccessAsync(Is <SendTaskSuccessRequest>(req => req.TaskToken == token && req.Output == expectedOutput )); }