Beispiel #1
0
 public void should_return_null_if_use_wrong_ticket()
 {
     var parkinglot1 = new Parkinglot(1);
     smartBoy.Manage(parkinglot1);
     var car = new Car();
     smartBoy.Park(car);
     smartBoy.PickUp(new Ticket());
 }
        public void should_return_ticket_when_parking_car_successfully()
        {
            var parkinglot = new Parkinglot(1);

            var ticket = parkinglot.Park(new Car());

            Assert.IsNotNull(ticket);
        }
        public void should_not_pick_up_if_provide_a_wrong_ticket()
        {
            var parkinglot = new Parkinglot(1);
            var car = new Car();
            parkinglot.Park(car);

            parkinglot.PickUp(new Ticket());
        }
        public void should_return_null_when_pick_up_car_twice()
        {
            var parkinglot = new Parkinglot(1);
            var car = new Car();
            var ticket = parkinglot.Park(car);

            parkinglot.PickUp(ticket);
            parkinglot.PickUp(ticket);
        }
        public void should_return_ticket_when_park_car_to_parking_boy()
        {
            var parkinglot = new Parkinglot(1);
            parkingBoy.Manage(parkinglot);

            var ticket = parkingBoy.Park(new Car());

            Assert.IsNotNull(ticket);
        }
        public void should_return_car_when_use_right_ticket()
        {
            var parkinglot = new Parkinglot(1);
            var car = new Car();
            var ticket = parkinglot.Park(car);

            var pickedCar = parkinglot.PickUp(ticket);

            Assert.AreSame(pickedCar,car);
        }
Beispiel #7
0
        public void should_return_null_if_all_the_parkinglot_has_no_avalibale_positions()
        {
            var parkinglot1 = new Parkinglot(0);
            smartBoy.Manage(parkinglot1);
            var parkinglot2 = new Parkinglot(0);
            smartBoy.Manage(parkinglot2);
            var ticket = smartBoy.Park(new Car());

            Assert.IsNull(ticket);
        }
Beispiel #8
0
        public void should_pick_up_cat_with_right_ticket()
        {
            var parkinglot1 = new Parkinglot(1);
            smartBoy.Manage(parkinglot1);
            var car = new Car();
            var ticket = smartBoy.Park(car);
            var pickCar = smartBoy.PickUp(ticket);

            Assert.AreSame(car, pickCar);
        }
Beispiel #9
0
        public void should_park_car_to_parking_lot_which_has_most_empty_positions()
        {
            var parkinglot1 = new Parkinglot(1);
            smartBoy.Manage(parkinglot1);
            var parkinglot2 = new Parkinglot(2);
            smartBoy.Manage(parkinglot2);
            var ticket = smartBoy.Park(new Car());

            Assert.IsNotNull(ticket);
            Assert.AreEqual(1,parkinglot1.AvailablePosition());
            Assert.AreEqual(1,parkinglot2.AvailablePosition());
        }
Beispiel #10
0
        static void Main(string[] args)
        {
            Parkinglot myparkinglot = new Parkinglot();

            List <Car> cars = myparkinglot.GenerateCarList();

            myparkinglot.PrintList(cars);

            myparkinglot.SameTypeCar1(cars);

            myparkinglot.SameTypeCar2(cars);

            myparkinglot.MostFrequentCarType(cars);

            myparkinglot.SameColorCar1(cars);

            myparkinglot.SameColorCar2(cars);

            myparkinglot.MostFrequentColor(cars);

            Console.ReadKey();
        }
 public void should_return_null_when_parkinglot_is_full()
 {
     var parkinglot = new Parkinglot(1);
     parkinglot.Park(new Car());
     parkinglot.Park(new Car());
 }
Beispiel #12
0
 public void Manage(Parkinglot parkinglot)
 {
     parkinglots.Add(parkinglot);
 }
Beispiel #13
0
        public void parkinglot_should_print_its_avalibale_position()
        {
            var parkinglot = new Parkinglot(1);
            var report = parkinglot.Print(new Reporter());

            Assert.AreEqual("parkinglot: 1\r\n", report);
        }