Ejemplo n.º 1
0
        public int GetHourlyFee(DateTime dateTime, Vehicle vehicle)
        {
            if (_freeDays.IsTollFree(dateTime) || _freeVehicleProvider.IsTollFree(vehicle.VehicleType))
            {
                return(0);
            }

            switch (dateTime.Hour)
            {
            case 6 when dateTime.Minute <= 29:
            case 8 when dateTime.Minute >= 30:
            case 9:
            case 10:
            case 11:
            case 12:
            case 13:
            case 14:
            case 18 when dateTime.Minute <= 29:
                return(9);

            case 6 when dateTime.Minute >= 30:
            case 8 when dateTime.Minute <= 29:
            case 15 when dateTime.Minute <= 29:
            case 17 when dateTime.Minute <= 59:
                return(16);

            case 7:
            case 15 when dateTime.Minute >= 30:
            case 16 when dateTime.Minute <= 59:
                return(22);

            default:
                return(0);
            }
        }
Ejemplo n.º 2
0
        public void IsTollFree_WhenPrivate_ShouldReturnFalse()
        {
            // Arrange
            ITollFreeVehicleProvider freeVehicleProvider = CreateSwedenTollFreeVehicle();
            Vehicle vehicle = new Vehicle(VehicleType.Private);

            // Act & Assert
            freeVehicleProvider.IsTollFree(vehicle.VehicleType).Should().BeFalse();
        }