예제 #1
0
 public object TestCreate()
 {
     Order order = new Order();
     order.OrderNumber = "test1";
     order.Create();
     return order;
 }
예제 #2
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);
 }
예제 #3
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);
        }
예제 #4
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));
            }
        }
예제 #5
0
 public void TestUpdate()
 {
     Order order = new Order();
     order.OrderNumber = "test1";
     order.Update();
 }
예제 #6
0
 public void TestDelete()
 {
     Order order = new Order();
     order.OrderNumber = "test1";
     order.Delete();
 }
예제 #7
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;
 }