/// <summary> /// Finds a list of products by their price. /// </summary> /// <param name="price"></param> /// <param name="where"></param> /// <returns>List<Product></returns> public List <Product> FindByPrice(double price, string where) { List <Product> result; switch (where) { case "Equal": result = db_product.FindProductByPrice(price); break; case "Higher": result = db_product.FindProductByPriceHigher(price); break; case "Lower": result = db_product.FindProductByPriceLower(price); break; default: result = new List <Product>(); break; } return(result); }
public void Success_FindProductByPriceLower() { //Arrange int index; Product product; Product result; //Act index = 503; product = new Product { Name = "ClassLibrary1 - Test product database - FindProductByPriceLower", Price = product_price + index }; db_product.CreateProduct(product); result = db_product.FindProductByPriceLower(product.Price)[0]; //Assert Assert.IsTrue(2000 > result.Price, result.Name); }