public void Test_Valid_Limit() { //Arrange int limit = -1; Mock <IProductService> mock = new Mock <IProductService>(); FoodFactController _controller = new FoodFactController(mock.Object); // Assert Assert.Throws <ArgumentException>(() => _controller.Get("sugar", limit)); }
public void Test_Get_ReturnsProducts() { //Arrange Mock <IProductService> mock = new Mock <IProductService>(); FoodFactController _controller = new FoodFactController(mock.Object); mock.Setup(p => p.GetProductsByIngredients()).Returns(product); // Act ProductResponse[] productResponses = _controller.Get(); // Assert Assert.Equal(1, productResponses.Length); }