public LambdaBootstrapTests()
 {
     _environmentVariables = new TestEnvironmentVariables();
     _testRuntimeApiClient = new TestRuntimeApiClient(_environmentVariables);
     _testInitializer      = new TestInitializer();
     _testFunction         = new TestHandler();
 }
 public LambdaBootstrapTests()
 {
     _environmentVariables = new TestEnvironmentVariables();
     _testRuntimeApiClient = new TestRuntimeApiClient(_environmentVariables);
     _testInitializer      = new TestInitializer();
     _testFunction         = new TestHandler();
     _testWrapper          = HandlerWrapper.GetHandlerWrapper(_testFunction.HandlerVoidVoidSync);
 }
        public HandlerWrapperTests()
        {
            var environmentVariables = new TestEnvironmentVariables();

            _lambdaEnvironment = new LambdaEnvironment(environmentVariables);

            var headers = new Dictionary <string, IEnumerable <string> >();

            headers.Add(RuntimeApiHeaders.HeaderAwsRequestId, new List <string>()
            {
                "request_id"
            });
            headers.Add(RuntimeApiHeaders.HeaderInvokedFunctionArn, new List <string>()
            {
                "invoked_function_arn"
            });
            _runtimeApiHeaders = new RuntimeApiHeaders(headers);
            _checkpoint        = new Checkpoint();
        }
Esempio n. 4
0
        // private readonly TestRuntimeApiClient _testRuntimeApiClient;

        public HandlerTests(ITestOutputHelper output)
        {
            // setup logger to write to optionally console
            _internalLogger = InternalLogger.GetCustomInternalLogger(output.WriteLine);
            _output         = output;

            var testDateTimeHelper   = new TestDateTimeHelper();
            var cognitoClientContext = File.ReadAllText("CognitoClientContext.json");
            var cognitoIdentity      = File.ReadAllText("CognitoIdentity.json");

            _headers = new Dictionary <string, IEnumerable <string> >
            {
                { RuntimeApiHeaders.HeaderAwsRequestId, new List <string> {
                      "Request1"
                  } },
                { RuntimeApiHeaders.HeaderInvokedFunctionArn, new List <string> {
                      "Arn1"
                  } },
                { RuntimeApiHeaders.HeaderClientContext, new List <string> {
                      cognitoClientContext
                  } },
                { RuntimeApiHeaders.HeaderCognitoIdentity, new List <string> {
                      cognitoIdentity
                  } },
                { RuntimeApiHeaders.HeaderDeadlineMs, new List <string> {
                      $"{(testDateTimeHelper.UtcNow - LambdaContext.UnixEpoch + TimeSpan.FromSeconds(42)).TotalMilliseconds}"
                  } }                                                                                                                                                                // (2020, 1, 1) + 42 seconds
            };

            var env = new Dictionary <string, string>
            {
                { LambdaEnvironment.EnvVarFunctionName, "Name1" },
                { LambdaEnvironment.EnvVarFunctionVersion, "Version1" },
                { LambdaEnvironment.EnvVarLogGroupName, "Group1" },
                { LambdaEnvironment.EnvVarLogStreamName, "Stream1" },
                { LambdaEnvironment.EnvVarFunctionMemorySize, "42" },
            };

            _environmentVariables = new TestEnvironmentVariables(env);
        }
Esempio n. 5
0
        public LambdaBootstrapTests()
        {
            _environmentVariables = new TestEnvironmentVariables();
            var headers = new Dictionary <string, IEnumerable <string> >
            {
                {
                    RuntimeApiHeaders.HeaderAwsRequestId, new List <string> {
                        "request_id"
                    }
                },
                {
                    RuntimeApiHeaders.HeaderInvokedFunctionArn, new List <string> {
                        "invoked_function_arn"
                    }
                }
            };

            _testRuntimeApiClient = new TestRuntimeApiClient(_environmentVariables, headers);
            _testInitializer      = new TestInitializer();
            _testFunction         = new TestHandler();
            _testWrapper          = HandlerWrapper.GetHandlerWrapper(_testFunction.HandlerVoidVoidSync);
        }
 public LambdaContextTests()
 {
     _environmentVariables = new TestEnvironmentVariables();
 }