コード例 #1
0
ファイル: BLProductColor.cs プロジェクト: louis1204/cs136_hw4
        public static int UpdateProductColor(int ProductColorId, string ProductColorName, ref List <string> errors)
        {
            if (ProductColorId <= 0 || ProductColorId > DALProductColor.ReadProductColorList(ref errors).Count)
            {
                errors.Add("Invalid ProductColor id");
            }

            if (errors.Count > 0)
            {
                return(-1);
            }

            return(DALProductColor.UpdateProductColor(ProductColorId, ProductColorName, ref errors));
        }
コード例 #2
0
        public void UpdateProductColorTest()
        {
            int              myId   = 1;
            Random           rand   = new Random();
            ProductColorInfo Color  = new ProductColorInfo(myId, "Sanrio Pink " + rand.Next(10000));
            List <string>    errors = new List <string>();
            int              result = DALProductColor.UpdateProductColor(Color.product_color_id, Color.product_color_name, ref errors);

            Assert.AreEqual(0, errors.Count);
            Assert.AreNotEqual(-1, result);

            ProductColorInfo verifyColor = DALProductColor.ReadProductColorDetail(myId, ref errors);

            Assert.AreEqual(0, errors.Count);

            Assert.AreEqual(Color.product_color_id, verifyColor.product_color_id);
            Assert.AreEqual(Color.product_color_name, verifyColor.product_color_name);
        }