Created
December 16, 2018 22:49
-
-
Save tonysneed/0dcbb31800619cedefeb44febb07d257 to your computer and use it in GitHub Desktop.
Function Test 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FunctionTest | |
{ | |
[Fact] | |
public void Function_Should_Return_Config_Variable() | |
{ | |
// Mock IConfiguration | |
var expected = "val1"; | |
var mockConfig = new Mock<IConfiguration>(); | |
mockConfig.Setup(p => p[It.IsAny<string>()]).Returns(expected); | |
// Mock IConfigurationService | |
var mockConfigService = new Mock<IConfigurationService>(); | |
mockConfigService.Setup(p => p.GetConfiguration()).Returns(mockConfig.Object); | |
// Invoke the lambda function and confirm config value is returned | |
var function = new Function(mockConfigService.Object); | |
var result = function.FunctionHandler("env1", new TestLambdaContext()); | |
Assert.Equal(expected, result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment