Exemple #1
0
        public void 存车_第一个车位量不够_第二个足够()
        {
            var two = new ParkingLot();
            //Given
            var p = new ParkingBoy
            {
                ParkingLots = new List <ParkingLot>()
                {
                    new ParkingLot(),
                    two
                }
            };

            p.ParkingLots[0].Capacity = 0;
            p.ParkingLots[1].Capacity = 10;
            var car = new Car();

            //When
            p.DepositCar(car);

            var car1 = p.WithDrawCar(car);

            Assert.Equal(car, car1);
            Assert.Equal(9, two.Capacity);
        }
Exemple #2
0
        public void 存车_车位量足够()
        {
            //Given
            var p = new ParkingBoy
            {
                ParkingLots = new List <ParkingLot>()
                {
                    new ParkingLot(),
                    new ParkingLot()
                }
            };

            p.ParkingLots[0].Capacity = 10;
            p.ParkingLots[1].Capacity = 10;
            var car = new Car();

            //When
            p.DepositCar(car);
            //Then
            var car1 = p.WithDrawCar(car);

            Assert.Equal(car, car1);
        }