コード例 #1
0
        public void DeleteMethodOK()
        {
            //create an instance of the class we want to create
            clsMenuCollection AllMenu = new clsMenuCollection();
            //create the item of test data
            clsMenu TestItem = new clsMenu();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set the properties
            TestItem.MenuItemID  = 0;
            TestItem.Name        = "Cheesy";
            TestItem.Description = "Classic cheese delite!";
            TestItem.RecipeID    = 1;
            TestItem.Price       = 5.0;
            //set ThisMenu to test data
            AllMenu.ThisItem = TestItem;
            //add the record
            PrimaryKey = AllMenu.Add();
            //set the primary key of the test data
            TestItem.MenuItemID = PrimaryKey;
            //find the record
            AllMenu.ThisItem.Find(PrimaryKey);
            //delete the record
            AllMenu.Delete();
            //now find the record
            Boolean Found = AllMenu.ThisItem.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
コード例 #2
0
    void DeleteMenuItem()
    {
        //function to delete the selected record
        //create a new instance of the MenuBook
        clsMenuCollection MenuBook = new clsMenuCollection();

        //find the record to delete
        MenuBook.ThisItem.Find(MenuID);
        //delete the record
        MenuBook.Delete();
    }