public void AddAndGetInfoForOneCar()
        {
            GreenRepository repoInfo      = new GreenRepository();
            GreenPlan       customerInfo  = new GreenPlan(1, 2015, "Honda", "Sonata", 32d, CarType.Hybrid);
            GreenPlan       customerInfo2 = new GreenPlan(2, 2010, "Honda", "Sonata", 32d, CarType.Hybrid);

            repoInfo.AddCarToList(customerInfo);
            repoInfo.AddCarToList(customerInfo2);

            var expected = customerInfo2;
            var actual   = repoInfo.GetCarInfo(2);

            Assert.AreEqual(expected, actual);
        }
        public void AddAndGetListOfCars()
        {
            GreenRepository repoInfo      = new GreenRepository();
            GreenPlan       customerInfo  = new GreenPlan(1, 2015, "Honda", "Sonata", 32d, CarType.Hybrid);
            GreenPlan       customerInfo2 = new GreenPlan(2, 2010, "Honda", "Sonata", 32d, CarType.Hybrid);

            repoInfo.AddCarToList(customerInfo);
            repoInfo.AddCarToList(customerInfo2);
            List <GreenPlan> list = repoInfo.GetAllCarInfo();

            var expected = 2;
            var actual   = list.Count;

            Assert.AreEqual(expected, actual);
        }
        private void AddACar()
        {
            Console.WriteLine("What is the cars ID number?");
            int carID = int.Parse(Console.ReadLine());

            Console.WriteLine("What is the year of the car?");
            int carYear = int.Parse(Console.ReadLine());

            Console.WriteLine("What is the cars model?");
            string modelName = Console.ReadLine();

            Console.WriteLine("What is the cars make?");
            string makeName = Console.ReadLine();

            Console.WriteLine("What is the gas mileage?");
            double gasMileage = double.Parse(Console.ReadLine());

            Console.WriteLine("What number best describes the cars type?\n" +
                              "1: Electric\n" +
                              "2: Hybrid\n" +
                              "3: Gas");
            int     cars    = int.Parse(Console.ReadLine());
            CarType carType = (CarType)cars;

            GreenPlan newCar = new GreenPlan(carID, carYear, modelName, makeName, gasMileage, carType);

            _carRepo.AddCarToList(newCar);
        }
Exemple #4
0
        public void RemoveCarFromList()
        {
            GreenRepository _greenRepo = new GreenRepository();
            Car             car        = new Car(CarType.Gas, "Honda", "Accord", 2009, 4, 256);

            Car carTwo = new Car();

            _greenRepo.AddCarToList(car);
            _greenRepo.AddCarToList(carTwo);

            _greenRepo.RemoveCarFromList(256);

            int actual   = _greenRepo.SeeAllCarsOnList().Count;
            int expected = 1;

            Assert.AreEqual(expected, actual);
        }
        public void AddCarToList()
        {
            Console.Clear();
            Console.WriteLine("What type of Car is this?\n" +
                              "1. Electric \n" +
                              "2. Hybrid\n" +
                              "3. Gas");
            string  carTypeAsString = Console.ReadLine();
            int     carTypeAsInt    = int.Parse(carTypeAsString);
            CarType carType         = (CarType)carTypeAsInt;

            Console.WriteLine("what is the make of the car?");
            string make = Console.ReadLine();

            Console.WriteLine("What is the model of the car?");
            string model = Console.ReadLine();


            Console.WriteLine("What is the year of the car?");
            string yearOfCarAsString = Console.ReadLine();
            int    yearOfCar         = int.Parse(yearOfCarAsString);


            Console.WriteLine("What is the number of doors on the car?");
            string numberofDoorsAsString = Console.ReadLine();
            int    numberOfDoors         = int.Parse(numberofDoorsAsString);

            Console.WriteLine("What is the ID number of the car?");
            string carIDAsString = Console.ReadLine();
            int    carID         = int.Parse(carIDAsString);


            Car newCarItem = new Car(carType, make, model, yearOfCar, numberOfDoors, carID);

            _greenRepo.AddCarToList(newCarItem);
        }
Exemple #6
0
        public void AddCarToListTest()

        {
            GreenRepository _greenRepo = new GreenRepository();
            Car             car        = new Car(CarType.Gas, "Honda", "Accord", 2009, 4, 256);


            _greenRepo.AddCarToList(car);

            List <Car> list = _greenRepo.SeeAllCarsOnList();

            int actual   = list.Count;
            int expected = 1;

            Assert.AreEqual(expected, actual);
            Assert.IsTrue(list.Contains(car));
        }