public void DeleteMethod()
        {
            //create an instance of a class
            clsTicketCollection AllTicket = new clsTicketCollection();
            //create the item of test data
            clsTicket TestItem = new clsTicket();
            //var to store the primarykey
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.TicketID           = 1;
            TestItem.TicketPurchaseDate = DateTime.Now.Date;
            TestItem.TicketNo           = "ASD456GH";
            TestItem.FlightNo           = 535;
            TestItem.SeatNo             = "53B";
            //set thisticket to the test data
            AllTicket.ThisTicket = TestItem;
            //add the record
            PrimaryKey = AllTicket.Add();
            //set the primary key of the test data
            TestItem.TicketID = PrimaryKey;
            //find the record
            AllTicket.ThisTicket.Find(PrimaryKey);
            //delete the record
            AllTicket.Delete();
            //now find the record
            Boolean Found = AllTicket.ThisTicket.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
Ejemplo n.º 2
0
    void DeleteTicket()
    {
        //function to delete the selected record

        //create a new instance of the Ticket book
        clsTicketCollection TicketBook = new clsTicketCollection();

        //find the record to delete
        TicketBook.ThisTicket.Find(TicketID);
        //delete the record
        TicketBook.Delete();
    }