예제 #1
0
 public void TestUpdate()
 {
     Product product = new Product();
     product.ProductSku = "test1";
     product.LongDescription = "This description was updated.";
     product.Update();
 }
예제 #2
0
 public void TestList()
 {
     int limit = 5, page = 1;
     Product product = new Product();
     product.Page = page++;
     product.Limit = limit;
     Product[] results = (Product[]) product.Read<Product[]>();
     Assert.AreEqual(limit, results.Length);
 }
예제 #3
0
        public void TestReadById()
        {
            Product product = new Product();
            product.ID = "1";
            Product[] results = (Product[]) product.Read<Product>();

            Assert.AreEqual(1, results.Length);

            Product result = results[0];
            Assert.AreEqual(product.ID, product.ID);
        }
예제 #4
0
        public void TestSearch()
        {
            string search = "e";
            Product product = new Product();
            product.LongDescription = search;

            Product[] results = (Product[]) product.Read<Product>();
            Assert.IsTrue(results.Length > 1);

            foreach (Product p in results) {
                Assert.IsTrue(p.LongDescription.Contains(search));
            }
        }
예제 #5
0
 public bool Exists()
 {
     if (string.IsNullOrWhiteSpace(this.ProductSku)) throw new InvalidProgramException("Must specify sku in Product.Exists()");
     Product product = new Product();
     product.ProductSku = this.ProductSku;
     Product[] products = (Product[]) product.Read<Product[]>();
     if (products.Length > 0 && ! string.IsNullOrWhiteSpace(products[0].ProductSku)) return true;
     else return false;
 }
예제 #6
0
 public void TestDelete()
 {
     Product product = new Product();
     product.ProductSku = "test1";
     product.Delete();
 }
예제 #7
0
 public object TestCreate()
 {
     Product product = new Product(Warehouse.Random.Inventory);
     product.Create();
     return product;
 }