public async Task TryProcessMessageEventIsNotS3EventDontProcessReturnFalse() { S3Event s3Event; A.CallTo(() => _s3EventDeserializer.TryDeserializeS3Event(A <string> ._, out s3Event)).Returns(false) .AssignsOutAndRefParameters(s3Event = null); bool result = await _s3EventMessageProcessor.TryProcessMessage(A.Fake <ILambdaContext>(), new Message()); A.CallTo(() => _s3EmailMessageProcessor.ProcessEmailMessage(A <string> ._, A <ILambdaContext> ._, A <S3Event> ._)).MustNotHaveHappened(); Assert.That(result, Is.False); }
public async Task <bool> TryProcessMessage(ILambdaContext context, Message message) { S3Event s3Event; if (_s3EventDeserializer.TryDeserializeS3Event(message.Body, out s3Event)) { _log.Info($"Successfully deserialised S3Event for message Id: {message.MessageId} for request Id: {context.AwsRequestId}"); return(await _s3EmailMessageProcessor.ProcessEmailMessage(message.MessageId, context, s3Event)); } _log.Error($"Skipping processing message as wasnt valid S3Event. Message had following body: {System.Environment.NewLine} {message.Body}"); return(false); }
public async Task <bool> TryProcessMessage(ILambdaContext context, Message message) { S3Event s3Event; if (_s3EventDeserializer.TryDeserializeS3Event(message.Body, out s3Event)) { if (s3Event.Records == null || s3Event.Records.Count == 0) { _log.Warn("S3 event contained no records."); return(false); } await _s3EmailMessageProcessor.ProcessEmailMessage(context, s3Event); return(true); } _log.Error($"Skipping processing message as wasnt valid S3Event. Message had following body: {Environment.NewLine} {message.Body}"); return(false); }