public void CarRepository_AddingCar()
        {
            //--Arrange
            CarClass newCar = new CarClass(carType.Hybrid, "Porsche", "918 Spyder", "2013", 89, 1);

            carRepo.AddCarToList(newCar);
            List <CarClass> CarList = carRepo.GetList();

            //--Act
            int actual   = CarList.Count;
            int expected = 4;

            //--Assert
            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void CarRepository_AddCarToList_ShouldIncreaseCountByOne()
        {
            //--Arrange
            Car car  = new Car("Ford", "Explorer", CarType.Gas, 17);
            var cars = _carRepo.GetCarList();

            _carRepo.AddCarToList(car);

            //--Act
            var actual   = cars.Count;
            var expected = 1;

            //--Assert
            Assert.AreEqual(expected, actual);
        }
Example #3
0
        public void CarRepository_AddCarToList_ShouldReturnCorrectCount()
        {
            //Arrange
            var carList = _carRepoTest.GetCarList();
            var car     = new Car();

            _carRepoTest.AddCarToList(car);

            //Act
            var actual   = carList.Count;
            var expected = 1;

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void RemoveClaim()
        {
            CarRepository carRepo = new CarRepository();
            Car           car     = new Car();

            Car carOne = new Car(CarType.Electric, 10, "2017 Chevy", "Bolt EV LT", 16500, 25998m);

            carRepo.AddCarToList(car);
            carRepo.AddCarToList(carOne);
            carRepo.RemoveCar(carOne);

            int actual   = carRepo.GetListOfCars().Count;
            int expected = 1;

            Assert.AreEqual(expected, actual);
        }
        public void AddCarToList()
        {
            CarRepository carRepository = new CarRepository();
            Car           carOne        = new Car(CarType.Electric, 10, "2017 Chevy", "Bolt EV LT", 16500, 25998m);
            Car           carTwo        = new Car();

            carRepository.AddCarToList(carOne);

            carRepository.AddCarToList(carTwo);
            List <Car> newCarInformation = carRepository.GetListOfCars();

            int actual   = newCarInformation.Count;
            int expected = 2;

            Assert.AreEqual(expected, actual);
            Assert.IsTrue(newCarInformation.Contains(carTwo));
        }
Example #6
0
        public void ShouldAddCarToList()
        {
            List <CAR> carList = _carRepo.GetCarList();


            _carRepo.AddCarToList(car1);
            _carRepo.AddCarToList(car2);
            _carRepo.AddCarToList(car3);


            var actual   = carList.Count;
            var expected = 3;

            Assert.AreEqual(expected, actual);
        }
        public void InsuranceCarRepository_RemoveFromList_ShouldReturnCorrectCount()
        {
            //Arrange
            CarRepository _carRepo  = new CarRepository();
            Car           bumbleBee = new Car("AutoBot", "Camaro", 1799, "muscle car", "Yellow with black racing stripes", 4, true, 0);
            //Even though the values aren't related to a car object they still satisfy the property types. I am showing non associated values to a car below to show that value can still be assigned even if it isn't what a car is in our mind.
            Car truck = new Car("This is a string type", "another string", 199, "right before this was a int value type. This is a string", "Another string", 400, false, 1998);

            //Act
            _carRepo.AddCarToList(bumbleBee);
            _carRepo.AddCarToList(truck);

            _carRepo.RemoveCarFromList(bumbleBee);

            int actual   = _carRepo.GetCarList().Count;
            int expected = 1;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Example #8
0
        //public void Run()
        //{
        //    RunMenu();
        //}
        //public void RunMenu()
        //{
        //    bool running = true;
        //    while (running)
        //    {
        //        Console.WriteLine("1. Add car to list\n" +
        //        "2. Remove car from list\n" +
        //        "3. Print list of cars\n" +
        //        "4. Exit");
        //        int input = int.Parse(Console.ReadLine());
        //        switch (input)
        //        {
        //            case 1:
        //                AddToList();
        //                break;
        //            case 2:
        //                RemoveCar();
        //                break;
        //            case 3:
        //                PrintCar();
        //                break;
        //            case 4:
        //                running = false;
        //                break;
        //            default:

        //                break;
        //        }
        //    }


        //}



        public void AddToList()
        {
            //Console.WriteLine("What is the Car type?");
            //string carTypeAsString = Console.ReadLine();
            //int CarType = int.Parse(carTypeAsString);

            Console.WriteLine("What is the car type?\n" +
                              "1. Electric\n" +
                              "2. Hybrid\n" +
                              "3. Gas");
            int carTypeAsInt = int.Parse(Console.ReadLine());

            //string carTypeAsString = Console.ReadLine();
            //int carTypeAsInt = int.Parse(carTypeAsString);

            CarType type;

            switch (carTypeAsInt)
            {
            default:
            case 1:
                type = CarType.Electric;
                break;

            case 2:
                type = CarType.Hybrid;
                break;

            case 3:
                type = CarType.Gas;
                break;
            }
            Console.WriteLine("What is the Car ID number? ");
            string carIDAsString = Console.ReadLine();
            int    carID         = int.Parse(carIDAsString);

            Console.WriteLine("What is the year and 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 mileage on the car? ");
            string mileageAsString = Console.ReadLine();
            int    mileage         = int.Parse(mileageAsString);

            Console.WriteLine("What is the price of the car? ($xx,xxx)");
            string  priceAsString = Console.ReadLine();
            decimal price         = decimal.Parse(priceAsString);



            Car newCarItem = new Car(type, carID, make, model, mileage, price);

            _carRepo.AddCarToList(newCarItem);
        }
        public void TestMehodAddCar()
        {
            //Arrange
            Car    car1           = new Car();
            string Make           = "Kia";
            string Model          = "Sedona";
            string Type           = "gas";
            int    MilesPerGallon = 16;

            //Act
            car1.Make           = Make;
            car1.Model          = Model;
            car1.Type           = Type;
            car1.MilesPerGallon = MilesPerGallon;
            carRepo.AddCarToList(car1);
            Car car = carRepo.GetCarByModel(Model);

            //Assert
            Assert.AreSame(car.Model, "Sedona", "car model does not match");
        }
        //Create new car
        private void CreateNewCar()
        {
            string type = String.Empty;

            Console.Clear();
            Car newCar = new Car();

            Console.WriteLine("Please enter the make of the new car.");
            newCar.Make = Console.ReadLine().ToLower();
            Console.WriteLine("Please enter the model of the new car.");
            newCar.Model = Console.ReadLine().ToLower();
            while (type.ToLower() != "gas" && type.ToLower() != "electric" && type.ToLower() != "hybrid")
            {
                Console.WriteLine("Please enter the type of new car.");
                type = Console.ReadLine().ToLower();
            }
            newCar.Type = type;
            Console.WriteLine("Please enter the miles per gallon of the new gas car.");
            string milesPerGallonAsString = Console.ReadLine().ToLower();

            newCar.MilesPerGallon = int.Parse(milesPerGallonAsString);
            carRepo.AddCarToList(newCar);
        }
        public void InsuranceCarRepository_AddToList_ShouldReturnCorrectCount()
        {
            //Arrange
            CarRepository _carRepo = new CarRepository();

            Car bumbleBee = new Car();

            bumbleBee.Brand            = "Autobots";
            bumbleBee.Model            = "Camaro";
            bumbleBee.Year             = 1984;
            bumbleBee.Type             = "Car";
            bumbleBee.Color            = "Yellow";
            bumbleBee.WheelCount       = 4;
            bumbleBee.PreviousAccident = true;
            bumbleBee.PreviousOwners   = 0;

            //Act
            _carRepo.AddCarToList(bumbleBee);
            int actual   = _carRepo.GetCarList().Count;
            int expected = 1;

            //Assert
            Assert.AreEqual(expected, actual);
        }