public void ProjectHasMultipleLambdaFunctionsAndFunctionHandlerNotGiven() { var runConfiguration = CreateRunConfiguration(); var buildPath = TestUtils.GetLambdaFunctionBuildPath("ServerlessTemplateExample"); TestToolStartup.Startup("Unit Tests", null, new string[] { "--path", buildPath, "--no-ui", "--payload", "\"hello WORLD\"" }, runConfiguration); Assert.Contains("Project has more then one Lambda function defined. Use the --function-handler switch to identify the Lambda code to execute.", runConfiguration.OutputWriter.ToString()); }
public void ServerlessTemplateFunctionCall() { var runConfiguration = CreateRunConfiguration(); var buildPath = TestUtils.GetLambdaFunctionBuildPath("ServerlessTemplateExample"); TestToolStartup.Startup("Unit Tests", null, new string[] { "--path", buildPath, "--no-ui", "--payload", "\"hello WORLD\"", "--function-handler", "ServerlessTemplateExample::ServerlessTemplateExample.Functions::HelloWorld" }, runConfiguration); Assert.Contains("Hello World Test", runConfiguration.OutputWriter.ToString()); }
public void PayloadFromFile() { var runConfiguration = CreateRunConfiguration(); var buildPath = TestUtils.GetLambdaFunctionBuildPath("ToUpperFunc"); TestToolStartup.Startup("Unit Tests", null, new string[] { "--path", buildPath, "--no-ui", "--payload", "payload-sample.json" }, runConfiguration); Assert.Contains("HELLO FROM PAYLOAD FILE", runConfiguration.OutputWriter.ToString()); }
public void DirectFunctionCallNotFromConfig() { var runConfiguration = CreateRunConfiguration(); var buildPath = TestUtils.GetLambdaFunctionBuildPath("ToUpperFunc"); TestToolStartup.Startup("Unit Tests", null, new string[] { "--path", buildPath, "--no-ui", "--payload", "\"hello WORLD\"", "--function-handler", "ToUpperFunc::ToUpperFunc.Function::ToLower" }, runConfiguration); Assert.Contains("hello world", runConfiguration.OutputWriter.ToString()); }
public void UseExplicitRegion() { var runConfiguration = CreateRunConfiguration(); var buildPath = TestUtils.GetLambdaFunctionBuildPath("ToUpperFunc"); TestToolStartup.Startup("Unit Tests", null, new string[] { "--path", buildPath, "--no-ui", "--payload", "\"hello WORLD\"", "--region", "fake-region" }, runConfiguration); Assert.Contains("HELLO WORLD", runConfiguration.OutputWriter.ToString()); Assert.Contains("Setting AWS_REGION environment variable to fake-region.", runConfiguration.OutputWriter.ToString()); }
public void NoProfileAndRegion() { var runConfiguration = CreateRunConfiguration(); var buildPath = TestUtils.GetLambdaFunctionBuildPath("FunctionSignatureExamples"); // Profile is set to a nonexisting profile because if no profile is set on the command line or config file then the default profile will be set if it exists. TestToolStartup.Startup("Unit Tests", null, new string[] { "--path", buildPath, "--no-ui", "--profile", "do-no-exist", "--payload", "\"hello WORLD\"", "--function-handler", "FunctionSignatureExamples::FunctionSignatureExamples.StaticMethods::TheStaticMethod" }, runConfiguration); Assert.Contains("Warning: Profile do-no-exist not found in the aws credential store.", runConfiguration.OutputWriter.ToString()); Assert.Contains("No default AWS region configured. The --region switch can be used to configure an AWS Region.", runConfiguration.OutputWriter.ToString()); }
public static void Main(string[] args) { Environment.SetEnvironmentVariable("AWS_EXECUTION_ENV", "AWS_DOTNET_LAMDBA_TEST_TOOL_BLAZOR_" + Utils.DetermineToolVersion()); TestToolStartup.Startup(Constants.PRODUCT_NAME, (options, showUI) => Startup.LaunchWebTester(options, showUI), args); }