示例#1
0
 public void TestList()
 {
     int limit = 5, page = 1;
     Order order = new Order();
     order.Page = page++;
     order.Limit = limit;
     Order[] results = (Order[]) order.Read<Order>();
     Assert.AreEqual(limit, results.Length);
 }
示例#2
0
        public void TestReadById()
        {
            Order order = new Order();
            order.ID = "1";
            Order[] results = (Order[]) order.Read<Order>();

            Assert.AreEqual(1, results.Length);

            Order result = results[0];
            Assert.AreEqual(order.ID, order.ID);
        }
示例#3
0
        public void TestSearch()
        {
            string search = "Active";
            Order order = new Order();
            order.OrderStatus = search;

            Order[] results = (Order[]) order.Read<Order>();
            Assert.IsTrue(results.Length > 1);

            foreach (Order o in results) {
                Assert.IsTrue(o.OrderStatus.Contains(search));
            }
        }
示例#4
0
 public bool Exists()
 {
     if (string.IsNullOrWhiteSpace(this.OrderNumber)) throw new InvalidProgramException("Must specify order number in Order.Exists()");
     Order order = new Order();
     order.OrderNumber = this.OrderNumber;
     Order[] orders = (Order[]) order.Read<Order[]>();
     if (orders.Length > 0 && ! string.IsNullOrWhiteSpace(orders[0].OrderNumber)) return true;
     else return false;
 }