コード例 #1
0
        public void UpdateMethodOK()
        {
            clsQualityCollection AllProducts = new clsQualityCollection();
            clsQuality           TestItem    = new clsQuality();
            Int32 PrimaryKey = 1;

            TestItem.Defective      = true;
            TestItem.ProductName    = "Blue";
            TestItem.StaffID        = 1;
            TestItem.BatchNo        = 1;
            TestItem.Grade          = 'A';
            TestItem.Date           = DateTime.Now.Date;
            AllProducts.ThisProduct = TestItem;
            PrimaryKey         = AllProducts.Add();
            TestItem.ProductNo = PrimaryKey;
            //modify test data
            TestItem.ProductName    = "Red";
            TestItem.StaffID        = 2;
            TestItem.BatchNo        = 2;
            TestItem.Date           = DateTime.Now.Date;
            TestItem.Grade          = 'C';
            TestItem.Defective      = false;
            AllProducts.ThisProduct = TestItem;
            AllProducts.Update();
            AllProducts.ThisProduct.Find(PrimaryKey);
            Assert.AreEqual(AllProducts.ThisProduct, TestItem);
        }