Exemplo n.º 1
0
        public void InsuranceCarRepository_InsuranceCost_DecimalShouldReturnCorrectValueBasedOnYear()
        {
            CarInsuranceRepository _carRepo = new CarInsuranceRepository();
            Car optimusPrime = new Car("Autobots", "PeterBilt 379", 1992, "Semi-Truck", "Blue with red flames", 10, false, 0);

            decimal actual   = _carRepo.InsuranceCost(optimusPrime);
            decimal expected = 2000;

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void InsuranceCarRepository_RemoveFromList_ShouldReturnCorrectCount()
        {
            //Arrange
            CarInsuranceRepository _carRepo = new CarInsuranceRepository();
            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);
        }
Exemplo n.º 3
0
        public void InsuranceCarRepository_AddToList_ShouldReturnCorrectCount()
        {
            //Arrange
            CarInsuranceRepository _carRepo = new CarInsuranceRepository();

            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);
        }