示例#1
0
        public void AddMethodOk()
        {
            //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 = "2949";
            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);
            //test to see that the 2 values are the same
            Assert.AreEqual(AllCars.ThisCar, TestItem);
        }
示例#2
0
        public void CarListAndCountOk()
        {
            //create an instance of the class we want to create
            clsCarCollection AllCars = new clsCarCollection();
            //create some test data to assign to the property
            //in this case the data needs to be a list of objects
            List <clsCar> Testlist = new List <clsCar>();
            //add an item to the list
            //create the item of test data
            clsCar TestItem = new clsCar();

            //set its proprties
            TestItem.CarID      = 1;
            TestItem.RegPlate   = "dy20abc";
            TestItem.CarName    = "Audi";
            TestItem.CarModel   = "S5";
            TestItem.CarColour  = "Blue";
            TestItem.EngineSize = "2949cc";
            TestItem.Price      = 150;
            //add the item to the test list
            Testlist.Add(TestItem);
            //assign the data to the property
            AllCars.CarList = Testlist;
            //test to see that the two values are the samw
            Assert.AreEqual(AllCars.CarList, Testlist);
        }
示例#3
0
        void PopulateArray(clsDataConnection DB)
        {
            //populates the array list based on the data table in the parameter DB
            //var for the index
            Int32 Index = 0;
            //var to store the record count
            Int32 RecordCount;

            //get the count of records
            RecordCount = DB.Count;
            //clear the private array list
            mCarList = new List <clsCar>();
            //while there are records to process
            while (Index < RecordCount)
            {
                //create a blank Car
                clsCar AnCar = new clsCar();
                //read in the fields from the current record
                AnCar.CarNo    = Convert.ToInt32(DB.DataTable.Rows[Index]["CarNo"]);
                AnCar.CarMake  = Convert.ToString(DB.DataTable.Rows[Index]["CarMake"]);
                AnCar.CarModel = Convert.ToString(DB.DataTable.Rows[Index]["CarModel"]);
                AnCar.Colour   = Convert.ToString(DB.DataTable.Rows[Index]["Colour"]);
                AnCar.BodyType = Convert.ToString(DB.DataTable.Rows[Index]["BodyType"]);
                AnCar.Age      = Convert.ToInt32(DB.DataTable.Rows[Index]["Age"]);
                AnCar.Active   = Convert.ToBoolean(DB.DataTable.Rows[Index]["Active"]);
                AnCar.Mileage  = Convert.ToInt32(DB.DataTable.Rows[Index]["Mileage"]);
                //add the record to the private data mamber
                mCarList.Add(AnCar);
                //point at the next record
                Index++;
            }
        }
示例#4
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);
        }
示例#5
0
        public void CarsListAndCountOK()
        {
            //Create an instance of the class we want to create.
            clsCarsCollection AllCars = new clsCarsCollection();
            //Create some test data to assign to the property.
            //In this case data needs to be a list of objects.
            List <clsCar> TestList = new List <clsCar>();
            //Add item to the list
            //Create the item of test data
            clsCar TestItem = new clsCar();

            //Set it's properties
            TestItem.CarManufacturer      = "Volkswagon";
            TestItem.CarModel             = "Golf R";
            TestItem.CarRegistrationPlate = "DE17 FGH";
            TestItem.CarColour            = "Yellow";
            TestItem.CarNumberOfDoors     = 5;
            TestItem.CarNumberOfSeats     = 5;
            TestItem.CarNeedsRepair       = true;
            TestItem.CarSold = false;
            //Add the items to the test list.
            TestList.Add(TestItem);
            //Assign the data to the property.
            AllCars.CarList = TestList;
            //Test to see that the two values are the same.
            Assert.AreEqual(AllCars.Count, TestList.Count);
        }
        public void AddMethodOK()
        {
            //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.Fuel     = true;
            TestItem.CarID    = 3;
            TestItem.ColourNo = 4;
            TestItem.CarName  = "Audi";
            TestItem.Model    = "A6 Sedan C8";
            TestItem.BodyType = "SUV";
            TestItem.Price    = 47739.99m;
            TestItem.Stock    = 3;
            TestItem.YearMade = DateTime.Now.Date;
            //set ThisCar to the test data
            AllCars.ThisCar = TestItem;
            //add the record
            PrimaryKey = AllCars.Add();
            //set the primary key of the test data
            TestItem.CarID = PrimaryKey;
            //find the record
            AllCars.ThisCar.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllCars.ThisCar, TestItem);
        }
        public void ListAndCountOK()
        {
            //create an instance of the class we want to create
            clsCarCollection AllCars = new clsCarCollection();
            //create some test data to assign to the property
            //in this case the data needs to be a list of objects
            List <clsCar> TestList = new List <clsCar>();
            //add an item to the list
            //create the time of test data
            clsCar TestItem = new clsCar();

            //set its properties
            TestItem.Fuel     = true;
            TestItem.CarID    = 3;
            TestItem.ColourNo = 4;
            TestItem.CarName  = "Audi";
            TestItem.Model    = "A6 Sedan C8";
            TestItem.BodyType = "SUV";
            TestItem.Price    = 44737.99m;
            TestItem.Stock    = 3;
            TestItem.YearMade = DateTime.Now.Date;
            //add the item to the test list
            TestList.Add(TestItem);
            //assign the data to the property
            AllCars.CarList = TestList;
            //test to see that the two values are the same
            Assert.AreEqual(AllCars.Count, TestList.Count);
        }
示例#8
0
        private void loadCarModel()
        {
            lvCarModel.Items.Clear();
            lvCarModel.SuspendLayout();
            carList = new List <clsCar>();

            clsCar clscar = new clsCar();

            carList = clscar.GetCarList();

            foreach (clsCar car in carList)
            {
                ListViewItem oItem = new ListViewItem();

                oItem.Text = car.Code;
                oItem.SubItems.Add(car.Name);
                oItem.SubItems.Add(car.Status.ToString());
                oItem.Tag = car;

                lvCarModel.Items.Add(oItem);
            }

            tsslCarModelCount.Text = "Row Count: " + lvCarModel.Items.Count;
            lvCarModel.ResumeLayout();
        }
示例#9
0
        // must pass car model. check username
        private void loadInventory(clsCar car)
        {
            lvInventory.Items.Clear();
            lvInventory.SuspendLayout();
            List <clsInventory> list = new List <clsInventory>();

            clsInventory clsinventory = new clsInventory();

            list = clsinventory.getList(car);

            foreach (clsInventory inventory in list)
            {
                ListViewItem oItem = new ListViewItem();

                oItem.Text = inventory.TrackingCode;
                oItem.SubItems.Add(inventory.Details);
                oItem.SubItems.Add(inventory.Supplier);
                oItem.Tag = inventory;

                lvInventory.Items.Add(oItem);
            }

            tsslInventoryAvailableStocks.Text = "Available Stocks: " + lvInventory.Items.Count;
            lvInventory.ResumeLayout();
        }
示例#10
0
        protected void btnUpdate_OnClick(object sender, EventArgs e)
        {
            clsUser user = (clsUser)Session["User"];
            clsCar  car  = new clsCar();

            car.CarId        = Convert.ToInt32(hdnCarId.Value);
            car.VehicleReg   = VehicleReg.Text;
            car.VehicleColor = VehicleColor.Text;
            car.VehicleMake  = VehicleMake.Text;
            car.VehicleModel = VehicleModel.Text;
            car.UserID       = user.UserID;

            if (car.CarId > 0)
            {
                mgtCar.Update(car);
                lblMessage.Text = "Car details updated successfully!";
            }
            else
            {
                mgtCar.Add(car);
                lblMessage.Text = "Car details added successfully!";
            }
            messageBox.Visible = true;
            ClearForm();
            BindMyCars();
        }
        public void AddMethodOk()
        {
            //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
            int 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);
            //test to see that the two values are the same
            Assert.AreEqual(AllCars.ThisCar, TestItem);
        }
        public void ListAndCountOK()
        {
            //create an instance of the class we want to create
            clsCarCollection AllCars = new clsCarCollection();
            //create some test data to assign to the property
            //in this case the data needs to be a list of objects
            List <clsCar> TestList = new List <clsCar>();
            //add an item to the list
            //create the item of test data
            clsCar TestItem = new clsCar();

            //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;
            //add the item to the test list
            TestList.Add(TestItem);
            //assign the data to the property
            AllCars.CarList = TestList;
            //test to see that the two values are the same
            Assert.AreEqual(AllCars.Count, TestList.Count);
        }
示例#13
0
        private void loadCarModel()
        {
            lvCarModel.Items.Clear();
            lvCarModel.SuspendLayout();
            List <clsCar> list = new List <clsCar>();

            clsCar oCar = new clsCar();

            list = oCar.GetCarList();

            foreach (clsCar car in list)
            {
                ListViewItem oItem = new ListViewItem();

                oItem.Text = car.Code;
                oItem.SubItems.Add(car.Name);
                oItem.ImageKey = "folder";


                oItem.Tag = car;

                lvCarModel.Items.Add(oItem);
            }

            lvCarModel.ResumeLayout();
        }
示例#14
0
        public void CarDeleteMethodOK()
        {
            //create an instance of the class we want to create.
            clsCarsCollection AllCars = new clsCarsCollection();
            //create the item of test data
            clsCar TestItem = new clsCar();
            //variable to store the primary key.
            Int32 PrimaryKey = 0;

            //set it's properties.
            TestItem.CarID                = 4;
            TestItem.CarManufacturer      = "BMW";
            TestItem.CarModel             = "i8";
            TestItem.CarRegistrationPlate = "FE17 GTE";
            TestItem.CarColour            = "yellow";
            TestItem.CarNumberOfDoors     = 5;
            TestItem.CarNumberOfSeats     = 5;
            TestItem.CarNeedsRepair       = false;
            TestItem.CarSold              = true;
            //set thiscar to the test date
            AllCars.ThisCar = TestItem;
            //add the record
            PrimaryKey = AllCars.Add();
            //set the primary key of the test data.
            TestItem.CarID = PrimaryKey;
            //find the record.
            AllCars.ThisCar.Find(PrimaryKey);
            //delete the record.
            AllCars.Delete();
            //now find the record.
            Boolean Found = AllCars.ThisCar.Find(PrimaryKey);

            //Test to see that the record was not found.
            Assert.IsFalse(Found);
        }
示例#15
0
        public void CarAddMethodOK()
        {
            //Create an instance of the class we want to create
            clsCarsCollection AllCars = new clsCarsCollection();
            //Create the item for test data.
            clsCar TestItem = new clsCar();
            //Var to store the primary key
            Int32 PrimaryKey = 0;

            //set it's properties
            TestItem.CarID                = 1;
            TestItem.CarManufacturer      = "Mini";
            TestItem.CarModel             = "Paceman";
            TestItem.CarRegistrationPlate = "FE64 JUI";
            TestItem.CarColour            = "White";
            TestItem.CarNumberOfDoors     = 5;
            TestItem.CarNumberOfSeats     = 4;
            TestItem.SupplierID           = 4;
            TestItem.CarNeedsRepair       = false;
            TestItem.CarSold              = false;
            //Set thiscar to the test data.
            AllCars.ThisCar = TestItem;
            //Find the record
            AllCars.ThisCar.Find(PrimaryKey);
            //Test to see if the two values are the same.
            Assert.AreEqual(AllCars.ThisCar, TestItem);
        }
示例#16
0
        public void InstanceOK()
        {
            //create an instance of our class clsCar
            clsCar ACar = new clsCar();

            //check to see that the class is not null
            Assert.IsNotNull(ACar);
        }
示例#17
0
        public void InstanceOK()
        {
            //create instance of the class we want to create
            clsCar ACar = new clsCar();

            //test to see it exists
            Assert.IsNotNull(ACar);
        }
示例#18
0
        public void InstanceOk()
        {
            //Create an instanceof the class we want to create
            clsCar AnCar = new clsCar();

            //test to see that it exists
            Assert.IsNotNull(AnCar);
        }
示例#19
0
        public void CarID()
        {
            clsCar ACar     = new clsCar();
            Int32  TestData = 21;

            //assgn the data to the property
            ACar.CarID = TestData;
            //applythe test
            Assert.AreEqual(ACar.CarID, TestData);
        }
示例#20
0
 protected void ddlMyCars_OnSelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddlMyCars.SelectedValue != "0")
     {
         clsCar car = mgtCar.GetCar(Convert.ToInt32(ddlMyCars.SelectedValue));
         VehicleReg.Text   = car.VehicleReg;
         VehicleColor.Text = car.VehicleColor;
         VehicleMake.Text  = car.VehicleMake;
         VehicleModel.Text = car.VehicleModel;
     }
 }
示例#21
0
        public void ColourNoPropertyOK()
        {
            //create an instance f the class we want to create
            clsCar ACar = new clsCar();
            //create some test data to assign to the property
            Int32 TestData = 3;

            //assign the data to the property
            ACar.ColourNo = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(ACar.ColourNo, TestData);
        }
示例#22
0
        public void EnginesizePropertyOk()
        {
            //create an instance of the class we want to create
            clsCar AnEngineSize = new clsCar();
            //create some test data to assign to the property
            string TestData = "2999";

            //assign the data to the property
            AnEngineSize.EngineSize = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AnEngineSize.EngineSize, TestData);
        }
示例#23
0
        public void RegPlatePropertyOk()
        {
            //create an instance of the class we want to create
            clsCar AnRegPlate = new clsCar();
            //create some test data to assign to the property
            string TestData = "AB69BNM";

            //assign the data to the property
            AnRegPlate.RegPlate = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AnRegPlate.RegPlate, TestData);
        }
示例#24
0
        public void CarModelPropertyOk()
        {
            //create an instance of the class we want to create
            clsCar AnCarModel = new clsCar();
            //create some test data to assign to the property
            string TestData = "RS7";

            //assign the data to the property
            AnCarModel.CarModel = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AnCarModel.CarModel, TestData);
        }
示例#25
0
        public void CarColourPropertyOK()
        {
            //create an instance of the class we want to create
            clsCar AnCarColour = new clsCar();
            //create some test data to assign to the property
            string TestData = "black";

            //assign the data to the property
            AnCarColour.CarColour = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AnCarColour.CarColour, TestData);
        }
示例#26
0
        public void CarIDPropertyOk()
        {
            //create an instance of the class we want to create
            clsCar AnCarId = new clsCar();
            //create some test data to assign to the property
            Int32 TestData = 1;

            //assign the data to the property
            AnCarId.CarID = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AnCarId.CarID, TestData);
        }
示例#27
0
        public void FuelPropertyOK()
        {
            //create an instance of the class we want to create
            clsCar ACar = new clsCar();
            //create some trest data to assign to the property
            Boolean TestData = true;

            //assign the data to the property
            ACar.Fuel = TestData;
            //test to see thst the two values are the same
            Assert.AreEqual(ACar.Fuel, TestData);
        }
示例#28
0
        public void YearMadePropertyOK()
        {
            //create an instance of the class we want to create
            clsCar ACar = new clsCar();
            //create some test data to assign to the property
            DateTime TestData = DateTime.Now.Date;

            //assign the data to the property
            ACar.YearMade = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(ACar.YearMade, TestData);
        }
示例#29
0
        public void ValidMethodOK()
        {
            //create an instance of the class we want to create
            clsCar ACar = new clsCar();
            //string variable to store any error message
            String Error = "";

            //invoke th method
            Error = ACar.Valid(CarName, Model, BodyType, YearMade);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
示例#30
0
        public void ModelPropertyOK()
        {
            //create an instance f the class we want to create
            clsCar ACar = new clsCar();
            //create some test data to assign to the property
            string TestData = "X5 E70";

            //assign the data to the property
            ACar.Model = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(ACar.Model, TestData);
        }