Created
December 21, 2018 21:03
-
-
Save tonysneed/1210a61f002db9188bb6ca704cd41a0a to your computer and use it in GitHub Desktop.
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
[Fact] | |
public async void Function_Should_Return_Product_By_Id() | |
{ | |
// Mock IProductRepository | |
var expected = new Product | |
{ | |
Id = 1, | |
ProductName = "Chai", | |
UnitPrice = 10 | |
}; | |
var mockRepo = new Mock<IProductRepository>(); | |
mockRepo.Setup(m => m.GetProduct(It.IsAny<int>())).ReturnsAsync(expected); | |
// Invoke the lambda function and confirm correct value is returned | |
var function = new Function(mockRepo.Object); | |
var result = await function.FunctionHandler("1", new TestLambdaContext()); | |
Assert.Equal(expected, result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment