public void DeleteMethodOk()
        {
            //create an instance of the class we want to create
            clsCarCollection AllMainteance = new clsCarCollection();
            //create the item of test data
            clsMaintenance TestItem = new clsMaintenance();
            //var to store the primary key
            int PrimaryKey = 0;

            //set its properties
            TestItem.Active        = true;
            TestItem.MaintenanceID = 1;
            TestItem.Cost          = 1;
            TestItem.Date          = DateTime.Now.Date;
            TestItem.Description   = "something";
            TestItem.Repair        = true;
            //add the item
            //set ThisCar to the test data
            AllMainteance.ThisMaitenance = TestItem;
            //add the record
            PrimaryKey = AllMainteance.Add();
            //set the primary key of the test data
            AllMainteance.ThisCar.Find(PrimaryKey);
            //Delete
            AllMainteance.Delete();
            //now find the record
            Boolean Found = AllMainteance.ThisMaitenance.Find(PrimaryKey);

            //test to see that the two values are the same
            Assert.IsFalse(Found);
        }
        public void DeleteMethodOk()
        {
            //create an instance of the class we want to create
            clsCarCollection AllCars = new clsCarCollection();
            //create the item of test data
            clsCar TestItem = new clsCar();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.CarNo    = 1;
            TestItem.CarMake  = "Honda";
            TestItem.CarModel = "Civic";
            TestItem.Colour   = "red";
            TestItem.BodyType = "Sedan";
            TestItem.Age      = 5;
            TestItem.Active   = true;
            TestItem.Mileage  = 100000;
            //set ThisCar to the test data
            AllCars.ThisCar = TestItem;
            //add the record
            PrimaryKey = AllCars.Add();
            //set the primary key of the test data
            TestItem.CarNo = PrimaryKey;
            //find the record
            AllCars.ThisCar.Find(PrimaryKey);
            //delete the record
            AllCars.Delete();
            //now find the record
            bool Found = AllCars.ThisCar.Find(PrimaryKey);

            //test to see that the two values are the same
            Assert.IsFalse(Found);
        }
示例#3
0
        public void DeleteMethodOk()
        {
            //create an instance of the class we want to create
            clsCarCollection AllCars = new clsCarCollection();
            //create the item of test data
            clsCar TestItem = new clsCar();
            //var to store the prim key
            Int32 PrimaryKey = 0;

            //set its proprties
            TestItem.RegPlate   = "dy20abc";
            TestItem.CarName    = "Audi";
            TestItem.CarModel   = "S5";
            TestItem.CarColour  = "Blue";
            TestItem.EngineSize = "2949cc";
            TestItem.Price      = 150;
            //set this cars to the test data
            AllCars.ThisCar = TestItem;
            //add record
            PrimaryKey = AllCars.Add();
            //set the prim key of the test data
            TestItem.CarID = PrimaryKey;
            //find the record
            AllCars.ThisCar.Find(PrimaryKey);
            //delte record
            AllCars.Delete();
            //find record
            Boolean Found = AllCars.ThisCar.Find(PrimaryKey);

            //test to see recrod not found
            Assert.IsFalse(Found);
        }
示例#4
0
    void DeleteCars()
    {
        //function to delete the selected record

        //create a new instance of the car book
        clsCarCollection CarBook = new clsCarCollection();

        //find the record to delete
        CarBook.ThisCar.Find(CarID);
        //delete record
        CarBook.Delete();
    }