コード例 #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
ファイル: Product.cs プロジェクト: warwickit/MozuFreestyle
 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;
 }