public void DeleteMethodOK()
        {
            //Create an instance of the class
            clsCarRepairsCollection AllCarRepairs = new clsCarRepairsCollection();
            //create the item of test data
            clsCarRepairs TestItem = new clsCarRepairs();
            //Var to store the primary key
            Int32 PrimaryKey = 0;

            //Set its properties
            TestItem.CarRepairID     = 8;
            TestItem.DaysInForRepair = 1;
            TestItem.DeadlineDate    = DateTime.Now.Date.AddDays(9);
            TestItem.PartPrice       = 200.00m;
            TestItem.PartRequired    = "4 new tyres";
            //set this repair to the test data
            AllCarRepairs.ThisCarRepair = TestItem;
            //add the record
            PrimaryKey = AllCarRepairs.Add();
            //set the primary key of the test data
            TestItem.CarRepairID = PrimaryKey;
            //find the record
            AllCarRepairs.ThisCarRepair.Find(PrimaryKey);
            //Delete the record
            AllCarRepairs.Archive();
            //Now find the record
            Boolean Found = AllCarRepairs.ThisCarRepair.Find(PrimaryKey);

            //Test to see if the two values are the same
            Assert.IsFalse(Found);
        }
Esempio n. 2
0
    //fucntion for archiving repair
    void ArchiveRepair()
    {
        //create an instance
        clsCarRepairsCollection CarRepair = new clsCarRepairsCollection();

        //run CarRepairID through the Find method
        CarRepair.ThisCarRepair.Find(CarRepairID);
        //call Archive method
        CarRepair.Archive();
    }