Пример #1
0
        public async Task InitializeAsync()
        {
            _settings = new LambdaTestHostSettings(() => new TestLambdaContext
            {
                Logger = new XunitLambdaLogger(_outputHelper),
            });

            _settings.AddFunction(
                new LambdaFunctionInfo(
                    nameof(BrokenFunction),
                    typeof(BrokenFunction),
                    nameof(BrokenFunction.Handle)));

            _settings.AddFunction(
                new LambdaFunctionInfo(
                    nameof(APIGatewayFunction),
                    typeof(APIGatewayFunction),
                    nameof(APIGatewayFunction.Handle)));

            _settings.AddFunction(
                new LambdaFunctionInfo(
                    nameof(ReverseStringFunction),
                    typeof(ReverseStringFunction),
                    nameof(ReverseStringFunction.Reverse)));

            _settings.AddFunction(
                new LambdaFunctionInfo(
                    nameof(SleepFunction),
                    typeof(SleepFunction),
                    nameof(SleepFunction.Handle),
                    1));

            _testHost = await LambdaTestHost.Start(_settings);

            var awsCredentials = new BasicAWSCredentials("not", "used");
            var lambdaConfig   = new AmazonLambdaConfig
            {
                ServiceURL    = _testHost.ServiceUrl.ToString().Replace("[::]", "localhost"),
                MaxErrorRetry = 0
            };

            _lambdaClient = new AmazonLambdaClient(awsCredentials, lambdaConfig);
        }