Exemplo n.º 1
0
        public void DeleteMethodOK()
        {
            //Create an isntance of the class we want to create
            clsRoomtypeCollection AllRooms = new clsRoomtypeCollection();
            //create the item of test data
            clsRoomType TestItem = new clsRoomType();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its proeprties
            TestItem.Active       = false;
            TestItem.RoomtypeID   = 81;
            TestItem.RoomFloorNo  = 1;
            TestItem.RoomtypeSize = "4 guests";
            TestItem.Roomtype     = "Standard";
            TestItem.DateTime     = DateTime.Now.Date;
            //set ThisRoomtype to the test dat
            AllRooms.ThisRoomtype = TestItem;
            //add the record
            PrimaryKey = AllRooms.Add();
            //set the primary key of the tst data
            TestItem.RoomtypeID = PrimaryKey;
            //find the record
            AllRooms.ThisRoomtype.Find(PrimaryKey);
            //delete the record
            AllRooms.Delete();
            //now find the record
            Boolean Found = AllRooms.ThisRoomtype.Find(PrimaryKey);

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

        //create a new instance of the Roomtype
        clsRoomtypeCollection RoomType = new clsRoomtypeCollection();

        //find the record to delete
        RoomType.ThisRoomtype.Find(RoomtypeID);
        //Delete the record
        RoomType.Delete();
    }