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); }
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); }
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)); } }
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; }