[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