Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var inventory = new List<Autos>();

            var a1 = new Autos(AutoMake.Ford, "Mustang", "Blue", 1967, 86808, 60);
            var a2 = new Autos(AutoMake.Dodge, "Dart", "Green", 1976, 86422, 50);
            var a3 = new Autos(AutoMake.Toyota, "Celica", "White", 1986, 78908, 70);
            var a4 = new Autos(AutoMake.Ford, "Taurus", "Gold", 1994, 64068, 42);
            var a5 = new Autos(AutoMake.Jeep, "Wrangler", "Red", 2000, 46068, 50);
            var a6 = new Autos(AutoMake.Chevy, "Ram", "White", 2004, 56086, 65);
            var a7 = new Autos(AutoMake.Toyota, "Tundra", "Blue", 2006, 42404, 40);
            var a8 = new Autos(AutoMake.Ford, "F-150", "Black", 2008, 26088, 35);

            inventory.Add(a1);
            inventory.Add(a2);
            inventory.Add(a3);
            inventory.Add(a4);
            inventory.Add(a5);
            inventory.Add(a6);

            foreach (Autos car in inventory)
            {
                car.PrintAutoInfo();
                Console.WriteLine();
            }

            Console.ReadLine();
        }
Exemplo n.º 2
0
        public void AccelerateDecelerateMaxSpeed()
        {
            var a1 = new Autos(AutoMake.Ford, "Mustang", "Blue", 1967, 84688, 60);
            const int expectedSpeed = 100;

            a1.Accelerate(60);
            a1.Decelerate(20);
            var actualSpeed = a1.CurrentSpeed;

            Assert.AreEqual(expectedSpeed, actualSpeed);
        }
Exemplo n.º 3
0
        public void Accelerate40()
        {
            //Assign
            var a1 = new Autos(AutoMake.Ford, "Mustang", "Blue", 1967, 98204, 0) { CurrentSpeed = 60 };
            const int expectedSpeed = 100;

            //Act
            a1.Accelerate(40);
            var actualSpeed = a1.CurrentSpeed;

            //Assert
            Assert.AreEqual(expectedSpeed, actualSpeed);
        }
Exemplo n.º 4
0
        public void Accelerate60()
        {
            //Assign
            var a1 = new Autos(AutoMake.Ford, "Mustang", "Red", 2010, 12446, 0) { CurrentSpeed = 60 };
            const int expectedSpeed = 120;

            //Act
            a1.Accelerate(60);
            var actualSpeed = a1.CurrentSpeed;

            //Assert
            Assert.AreEqual(expectedSpeed, actualSpeed);
        }
Exemplo n.º 5
0
        public void Accelerate0()
        {
            //Assign
            var a1 = new Autos(AutoMake.Dodge, "Dart", "Green", 1976, 86088, 0) { CurrentSpeed = 60 };
            const int expectedSpeed = 60;

            //Act
            a1.Accelerate(0);
            var actualSpeed = a1.CurrentSpeed;

            //Assert
            Assert.AreEqual(expectedSpeed, actualSpeed);
        }
Exemplo n.º 6
0
        public void AccelerateMaxSpeed()
        {
            //Assign
            var a1 = new Autos(AutoMake.Nissan, "Altima", "White", 2008, 22046, 0) { CurrentSpeed = 60 };
            const int expectedSpeed = 120;

            //Act
            a1.Accelerate(70);
            var actualSpeed = a1.CurrentSpeed;

            //Assert
            Assert.AreEqual(expectedSpeed, actualSpeed);
        }
Exemplo n.º 7
0
        public void SpeedMessageOverLimit()
        {
            //Assign
            var a1 = new Autos(AutoMake.Ford, "Mustang", "Blue", 1967, 98204, 66);
            var expectedMessage = "You are over the speed limit: " + a1.CurrentSpeed + " MPH";

            //Act
            a1.CurrentSpeed = 66;
            var actualMessage = a1.SpeedMessage();

            //Assert
            Assert.AreEqual(expectedMessage, actualMessage);
        }
Exemplo n.º 8
0
        public void SpeedMessageBelowLimit()
        {
            //Assign
            var a1 = new Autos(AutoMake.Dodge, "Dart", "Green", 1976, 68044, 64);
            var expectedMessage = "Your current speed is OK: " + a1.CurrentSpeed + " MPH";

            //Act
            //a1.CurrentSpeed = 64;
            var actualMessage = a1.SpeedMessage();

            //Assert
            Assert.AreEqual(expectedMessage, actualMessage);
        }
Exemplo n.º 9
0
        public void DrivingLocation()
        {
            //Assign
            var a1 = new Autos(AutoMake.Dodge, "Dart", "Green", 1976, 68044, 64);
            const string expectedMessage = "Driving to Seattle";

            //Act
            var actualMessage = a1.Drive("Seattle");

            //Assert
            Assert.AreEqual(expectedMessage, actualMessage);
        }
Exemplo n.º 10
0
        public void DriveMiles()
        {
            //Assign
            var a1 = new Autos(AutoMake.Dodge, "Dart", "Green", 1976, 68044, 64);
            const string expectedMessage = "Driving 1270 miles";

            //Act
            var actualMessage = a1.Drive(1270);

            //Assert
            Assert.AreEqual(expectedMessage, actualMessage);
        }