コード例 #1
0
ファイル: Tester.cs プロジェクト: erikringwalters/Cars
        public void CheckSupercarSpeed()
        {
            Supercar superSpeedCheck = new Supercar();

            superSpeedCheck.TurnOn();
            superSpeedCheck.PressAccelerator(230);
            Assert.IsTrue(superSpeedCheck.GetReport().Status == Status.Moving);
            Assert.IsTrue(superSpeedCheck.GetReport().CurrentSpeed == 200);
            superSpeedCheck.PressAccelerator();
            Assert.IsTrue(superSpeedCheck.GetReport().CurrentSpeed == 30);
        }
コード例 #2
0
        public static void ListThem()
        {
            List <Car> carList = new List <Car>();
            Car        carA    = new Car();

            carA.Color = "blue";
            carA.TurnOn();
            carA.PressAccelerator();
            carList.Add(carA);
            Car carB = new Car();

            carB.Color = "red";
            carB.TurnOn();
            carB.PressAccelerator(200);
            carList.Add(carB);
            Supercar carC = new Supercar();

            carC.Color = "green";
            carC.TurnOn();
            carC.PressAccelerator(200);
            carList.Add(carC);
            Console.WriteLine("list size is " + carList.Count);
            //Trace.WriteLine("list size is " + carList.Count);
            //Console.ReadLine();
            foreach (Car car in carList)
            {
                Console.WriteLine(car.ToString());
            }
        }
コード例 #3
0
ファイル: Tester.cs プロジェクト: erikringwalters/Cars
        public void ListThem()
        {
            List <Car> carList = new List <Car>();
            Car        carA    = new Car();

            carA.Color = "blue";
            carA.TurnOn();
            carA.PressAccelerator();
            carList.Add(carA);
            Car carB = new Car();

            carB.Color = "red";
            carB.TurnOn();
            carB.PressAccelerator(200);
            carList.Add(carB);
            Supercar carC = new Supercar();

            carC.Color = "green";
            carC.TurnOn();
            carC.PressAccelerator(200);
            carList.Add(carC);
            Console.WriteLine("list size is " + carList.Count);
            Trace.WriteLine("list size is " + carList.Count);
        }