public void Success_FindOrderByPriceHigher()
        {
            //Arrange
            int          index;
            int          max_index;
            List <Order> result;

            //Act
            index     = 0;
            max_index = 100;

            while (index < max_index)
            {
                Order order = new Order
                {
                    Price     = 401.0 + index,
                    IsShipped = true,
                    Username  = user.Username
                };

                db_order.CreateOrder(order);

                index++;
            }

            result = db_order.FindOrderByPriceHigher(450.0);

            //Assert
            Assert.IsTrue(result.Count >= 50);
        }
Exemple #2
0
        /// <summary>
        /// Finds a list of orders by their price.
        /// </summary>
        /// <param name="price"></param>
        /// <param name="where"></param>
        /// <returns>List<Order></returns>
        public List <Order> FindByPrice(double price, string where)
        {
            List <Order> result;

            switch (where)
            {
            case "Equal":
                result = db_order.FindOrderByPrice(price);
                break;

            case "Higher":
                result = db_order.FindOrderByPriceHigher(price);
                break;

            case "Lower":
                result = db_order.FindOrderByPriceLower(price);
                break;

            default:
                result = new List <Order>();
                break;
            }

            return(result);
        }