public void DeleteMethodOK()
        {
            //crate an instance of the class we want to create
            clsGamesCollection AllGames = new clsGamesCollection();
            //crate the item of test data
            clsGames TestItem = new clsGames();

            //var to store the primry key
            Int32 Primarykey = 0;

            //set its properties
            TestItem.Game_ID          = 1;
            TestItem.Game_Name        = "Areeb";
            TestItem.Game_Description = "This is my tes data";
            TestItem.Game_Quantity    = 25;
            TestItem.Platform         = "PlayStation";
            TestItem.Supplier_ID      = 21;
            //set this game to the test data
            AllGames.ThisGame = TestItem;
            //add the record
            Primarykey = AllGames.Add();
            // set the primary key of the test data
            TestItem.Game_ID = Primarykey;
            //find the record
            AllGames.ThisGame.Find(Primarykey);
            //delete the record
            AllGames.Delete();
            //now find the record
            Boolean Found = AllGames.ThisGame.Find(Primarykey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
    protected void btnYes_Click(object sender, EventArgs e)
    {
        clsGamesCollection GamesList = new clsGamesCollection();

        GamesList.ThisGame.Find(GameId);
        GamesList.Delete();
        Response.Redirect("GamesList.aspx");
    }
示例#3
0
    void Delete()
    {
        //function to delete selected record
        //create a new instance of the address book
        clsGamesCollection GamesStore = new clsGamesCollection();

        //find the record to delete
        GamesStore.ThisGame.Find(Game_ID);
        //delete the record
        GamesStore.Delete();
    }
示例#4
0
        public void DeleteMethodOK()
        {
            clsGamesCollection AllGames = new clsGamesCollection();
            clsGame            TestGame = new clsGame();
            int PrimaryKey = 0;

            TestGame.GameTitle     = "Some Game";
            TestGame.Price         = 11.99;
            TestGame.Discount      = 20;
            TestGame.DatePublished = DateTime.Now.Date;
            TestGame.Active        = true;
            AllGames.ThisGame      = TestGame;
            PrimaryKey             = AllGames.Add();
            TestGame.GameId        = PrimaryKey;
            AllGames.ThisGame.Find(PrimaryKey);
            AllGames.Delete();
            bool Found = AllGames.ThisGame.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }