Example #1
0
        private async Task <APIGatewayProxyResponse> InvokeAPIGatewayRequestWithContent(TestLambdaContext context, string requestContent)
        {
            var lambdaFunction = new ApiGatewayLambdaFunction();
            var request        = JsonConvert.DeserializeObject <APIGatewayProxyRequest>(requestContent);

            return(await lambdaFunction.FunctionHandlerAsync(request, context));
        }
        private async Task <APIGatewayProxyResponse> InvokeAPIGatewayRequestWithContent(TestLambdaContext context, string requestContent)
        {
            var lambdaFunction = new ApiGatewayLambdaFunction();
            var requestStream  = new MemoryStream(System.Text.UTF8Encoding.UTF8.GetBytes(requestContent));
            var request        = new Amazon.Lambda.Serialization.SystemTextJson.LambdaJsonSerializer().Deserialize <APIGatewayProxyRequest>(requestStream);

            return(await lambdaFunction.FunctionHandlerAsync(request, context));
        }
Example #3
0
        private async Task <APIGatewayProxyResponse> InvokeAPIGatewayRequest(TestLambdaContext context, string fileName)
        {
            var lambdaFunction = new ApiGatewayLambdaFunction();
            var filePath       = Path.Combine(Path.GetDirectoryName(this.GetType().GetTypeInfo().Assembly.Location), fileName);
            var requestStr     = File.ReadAllText(filePath);
            var request        = JsonConvert.DeserializeObject <APIGatewayProxyRequest>(requestStr);

            return(await lambdaFunction.FunctionHandlerAsync(request, context));
        }