public void Should_parking_lot_service_manager_add_super_smart_parking_boy_to_managementList() { // given List <ParkingLot> parkingLotListForManager = new List <ParkingLot> { new ParkingLot(0), new ParkingLot(1) }; List <ParkingLot> parkingLotListForParkingBoy = new List <ParkingLot> { new ParkingLot(2), new ParkingLot(3) }; var expectedSuperSmartParkingBoy = new SuperSmartParkingBoy(parkingLotListForParkingBoy); var parkingLotServiceManager = new ParkingLotServiceManager(parkingLotListForManager, new List <ParkingBoy>()); parkingLotServiceManager.AddParkingBoy(expectedSuperSmartParkingBoy); // when var specifiedParkingBoy = parkingLotServiceManager.SpecifyParkingBoy(); // then Assert.Equal(expectedSuperSmartParkingBoy, specifiedParkingBoy); }
public void Should_specified_parking_boy_only_manipulate_parking_lots_managed_by_him() { // given List <ParkingLot> parkingLotListForManager = new List <ParkingLot> { new ParkingLot(0), new ParkingLot(1) }; List <ParkingLot> parkingLotListForParkingBoy = new List <ParkingLot> { new ParkingLot(2, 0), new ParkingLot(3, 0) }; var standardParkingBoy = new ParkingBoy(parkingLotListForParkingBoy); var parkingLotServiceManager = new ParkingLotServiceManager(parkingLotListForManager, new List <ParkingBoy>()); parkingLotServiceManager.AddParkingBoy(standardParkingBoy); var specifiedParkingBoy = parkingLotServiceManager.SpecifyParkingBoy(); // when string errorMessage; specifiedParkingBoy.ParkCar(new Car(), out errorMessage); // then Assert.Equal("Not enough position.", errorMessage); }
public void Should_parking_lot_service_manager_has_have_same_error_message_with_prcking_boy_when_parking_boy_fails_operation() { // given List <ParkingLot> parkingLotListForManager = new List <ParkingLot> { new ParkingLot(0), new ParkingLot(1) }; List <ParkingLot> parkingLotListForParkingBoy = new List <ParkingLot> { new ParkingLot(2, 0), new ParkingLot(3, 0) }; var standardParkingBoy = new ParkingBoy(parkingLotListForParkingBoy); var parkingLotServiceManager = new ParkingLotServiceManager(parkingLotListForManager, new List <ParkingBoy>()); parkingLotServiceManager.AddParkingBoy(standardParkingBoy); var specifiedParkingBoy = parkingLotServiceManager.SpecifyParkingBoy(); // when string errorMessage; specifiedParkingBoy.ParkCar(new Car(), out errorMessage); string errorMessageFromManager = parkingLotServiceManager.ErrorMessage; // then Assert.Equal("Not enough position.", errorMessage); Assert.Equal(errorMessage, errorMessageFromManager); }