Пример #1
0
        public void CreateProductVariationErrorTest()
        {
            List <string> errors         = new List <string>(); // TODO: Initialize to an appropriate value
            List <string> errorsExpected = new List <string>(); // TODO: Initialize to an appropriate value

            BLProductVariation.CreatePV(null, ref errors);
            AsynchLog.LogNow(errors);

            Assert.AreEqual(1, errors.Count);

            errors = new List <string>(); // TODO: Initialize to an appropriate value
            int    invalid_pv_id              = BLProductVariation.ReadAllPV(ref errors).Count + 1;
            int    invalid_product_id         = BLProduct.ReadAllProduct(ref errors).Count + 1;
            int    invalid_brand_id           = BLBrand.ReadAllBrand(ref errors).Count + 1;
            int    invalid_product_color_id   = BLProductColor.ReadAllProductColor(ref errors).Count + 1;
            int    invalid_product_cutting_id = BLProductCutting.ReadAllProductCutting(ref errors).Count + 1;
            char   invalid_sex             = 'Q';
            string invalid_size            = "huge";
            int    invalid_stock           = -1;
            int    invalid_price           = -1;
            char   invalid_condition       = 'f';
            int    invalid_product_type_id = BLProductType.ReadAllProductType(ref errors).Count + 1;

            ProductVariationInfo ipv = new ProductVariationInfo(invalid_pv_id, invalid_product_id, invalid_brand_id, invalid_product_cutting_id, invalid_product_color_id,
                                                                invalid_product_type_id, invalid_sex, invalid_size, invalid_stock, invalid_price, invalid_condition);


            BLProductVariation.CreatePV(ipv, ref errors);
            Assert.AreEqual(8, errors.Count);
            AsynchLog.LogNow(errors);
        }
Пример #2
0
        public void ProductReadErrorTest()
        {
            List <string> errors             = new List <string>(); // TODO: Initialize to an appropriate value
            int           invalid_Product_id = BLProduct.ReadAllProduct(ref errors).Count + 1;

            BLProduct.ReadProduct(invalid_Product_id, ref errors);
            AsynchLog.LogNow(errors);
            BLProduct.ReadProduct(-1, ref errors);
            AsynchLog.LogNow(errors);
            Assert.AreEqual(2, errors.Count);
        }
Пример #3
0
        public void ReadAllProductTest()
        {
            List <string>      errors         = new List <string>(); // TODO: Initialize to an appropriate value
            List <string>      errorsExpected = new List <string>(); // TODO: Initialize to an appropriate value
            List <ProductInfo> ProductList1   = BLProduct.ReadAllProduct(ref errors);

            AsynchLog.LogNow(errors);
            List <ProductInfo> ProductList2 = BLProduct.ReadAllProduct(ref errors);

            AsynchLog.LogNow(errors);

            Assert.AreEqual(ProductList1.Count, ProductList2.Count);
            Assert.AreEqual(errors.Count, 0);
            for (int i = 0; i < ProductList1.Count; i++)
            {
                Assert.AreEqual(ProductList1[i].product_id, ProductList2[i].product_id);
                Assert.AreEqual(ProductList1[i].product_name, ProductList2[i].product_name);
            }
        }
Пример #4
0
 public List <ProductInfo> ReadAllProduct(ref List <string> errors)
 {
     return(BLProduct.ReadAllProduct(ref errors));
 }