Example #1
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());
            }
        }
Example #2
0
        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);
        }
Example #3
0
        public async Task <Supercar> GetLeaderboardById(int supercarId)
        {
            Supercar leaderBoard = new Supercar();
            var      myUri       = new Uri(hostUrl + $"api/supercar/{supercarId}");

            try
            {
                var response = await _client.GetAsync(myUri);

                if (response.IsSuccessStatusCode)
                {
                    var context = await response.Content.ReadAsStringAsync();

                    leaderBoard = JsonConvert.DeserializeObject <Supercar>(context);
                }
                return(leaderBoard);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Example #4
0
        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);
        }