Ejemplo n.º 1
0
        public void ShouldAssignSameSizedSpotWhenAvailable(Size size)
        {
            var testParkingLot = GetFakeParkingLot(); //Fake lot with  5 slots in each type.
            var testVehicle    = GetFakeVehicle(size);
            var expectedSpot   = new ParkingSpot {
                OccupiedVehicle = testVehicle, SpotSize = testVehicle.VehicleSize
            };

            _svc = new ParkingLotManager.ParkingLot(testParkingLot, _searchService.Object);
            switch (size)
            {
            case Size.Hatchback:
                _searchService.Setup(x => x.Search(testParkingLot, Size.Hatchback)).Returns(expectedSpot);

                break;

            case Size.Sedan:
                _searchService.Setup(x => x.Search(testParkingLot, Size.Sedan)).Returns(expectedSpot);

                break;

            case Size.Truck:
                _searchService.Setup(x => x.Search(testParkingLot, Size.Truck)).Returns(expectedSpot);
                break;
            }
            ParkingSpot result = _svc.AssignParkingSpot(testVehicle);

            Assert.AreEqual(result.SpotSize, expectedSpot.SpotSize);
            Assert.AreEqual(result.OccupiedVehicle, expectedSpot.OccupiedVehicle);
        }
Ejemplo n.º 2
0
        public void ShouldSayParkingFullWhenHatchbackisAvailablButSedanAndTruckAreUnavailable(Size size)
        {
            var testParkingLot = GetFakeParkingLot(); //Fake lot with  5 slots in each type.

            var testVehicle = GetFakeVehicle(size);

            _svc = new ParkingLotManager.ParkingLot(testParkingLot, _searchService.Object);

            switch (size)
            {
            case Size.Sedan:
                _searchService.Setup(x => x.Search(testParkingLot, Size.Sedan)).Returns((ParkingSpot)null);
                _searchService.Setup(x => x.Search(testParkingLot, Size.Truck)).Returns((ParkingSpot)null);

                break;

            case Size.Truck:
                _searchService.Setup(x => x.Search(testParkingLot, Size.Truck)).Returns((ParkingSpot)null);
                break;
            }

            ParkingSpot result = _svc.AssignParkingSpot(testVehicle);

            Assert.AreEqual(result, null);
        }
Ejemplo n.º 3
0
        public ParkingLotController(IParkingLotService parkingLotService,
                                    IUserService userService,
                                    IHostingEnvironment hostingEnvironment)
        {
            _parkingLotService  = parkingLotService;
            _userService        = userService;
            _hostingEnvironment = hostingEnvironment;

            _path = Path.Combine(_hostingEnvironment.WebRootPath, "Images", "ParkingLot");
        }
Ejemplo n.º 4
0
        public VehicleRegistrationService(IRepository <Data.Vehicle> vehicleRepository,
                                          IRepository <Data.PromotionCard> promotionCardRepository,
                                          IRepository <Data.VehicleCategory> vehicleCategoryRepository,
                                          IParkingLotService parkingLotService)
        {
            this.vehicleRepository         = vehicleRepository;
            this.promotionCardRepository   = promotionCardRepository;
            this.vehicleCategoryRepository = vehicleCategoryRepository;

            this.parkingLotService = parkingLotService;
        }
Ejemplo n.º 5
0
        public void ShouldAssignTruckSpotWhenHatchBackAndSedanIsUnavailable()
        {
            var testParkingLot = GetFakeParkingLot(); //Fake lot with  5 slots in each type.

            var testVehicle = GetFakeVehicle(Size.Hatchback);

            var expectedSpot = new ParkingSpot {
                OccupiedVehicle = testVehicle, SpotSize = Size.Truck
            };

            _svc = new ParkingLotManager.ParkingLot(testParkingLot, _searchService.Object);

            _searchService.Setup(x => x.Search(testParkingLot, Size.Hatchback)).Returns((ParkingSpot)null);
            _searchService.Setup(x => x.Search(testParkingLot, Size.Sedan)).Returns((ParkingSpot)null);
            _searchService.Setup(x => x.Search(testParkingLot, Size.Truck)).Returns(expectedSpot);

            ParkingSpot result = _svc.AssignParkingSpot(testVehicle);

            Assert.AreEqual(result.SpotSize, expectedSpot.SpotSize);
            Assert.AreEqual(result.OccupiedVehicle, expectedSpot.OccupiedVehicle);
        }
 public ParkingLotsController(IParkingLotService parkingLotService)
 {
     this.parkingLotService = parkingLotService;
 }
 public ParkingLotController(IParkingLotService parkingLotService, IParkingFloorService parkingFloorService)
 {
     this.parkingLotService   = parkingLotService;
     this.parkingFloorService = parkingFloorService;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SecurityController"/> class.
 /// </summary>
 /// <param name="service">IparkinglotService object.</param>
 public SecurityController(IParkingLotService service)
 {
     this.service = service;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PoliceController"/> class.
 /// </summary>
 /// <param name="service">service.</param>
 public PoliceController(IParkingLotService service)
 {
     this.service = service;
 }
Ejemplo n.º 10
0
 public ParkingLotsController(Mapper mapper, IParkingLotService service)
 {
     this.mapper  = mapper;
     this.service = service;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DriverController"/> class.
 /// </summary>
 /// <param name="service">IparkinglotService object.</param>
 public DriverController(IParkingLotService service)
 {
     this.service = service;
 }
Ejemplo n.º 12
0
 public AllocationService(ParkSharkDbContext context, IMemberService memberService, IParkingLotService parkingLotService)
 {
     this.context           = context;
     this.memberService     = memberService;
     this.parkingLotService = parkingLotService;
 }
Ejemplo n.º 13
0
 public Menu(IParkingLotService parkingLotService)
 {
     _parkingLotService = parkingLotService;
 }
Ejemplo n.º 14
0
 public ParkingLotsController(IParkingLotMapper parkingLotMapper, IParkingLotService parkingLotService)
 {
     _parkingLotMapper  = parkingLotMapper;
     _parkingLotService = parkingLotService;
 }
 public OrdersController(IOrderService orderService, IParkingLotService parkingLotService)
 {
     this.orderService      = orderService;
     this.parkingLotService = parkingLotService;
 }
Ejemplo n.º 16
0
 public ParkingLotController(ILogger <ParkingLotController> logger,
                             IParkingLotService parkingLotService)
 {
     this.logger            = logger;
     this.parkingLotService = parkingLotService;
 }