Esempio n. 1
0
 public PatchVehiclesController(IVehicleCommands vehicleCommands, IVehicleQueries vehicleQueries, IVehicleEntityMapper entityMapper, IVehicleModelValidation vehicleModelValidation, IVehicleModelMapper vehicleModelMapper)
 {
     _vehicleCommands        = vehicleCommands;
     _vehicleQueries         = vehicleQueries;
     _vehicleModelValidation = vehicleModelValidation;
     _vehicleModelMapper     = vehicleModelMapper;
 }
        /// <summary>
        /// Builds a new instance of VehicleCommand depending the command key value.
        /// </summary>
        /// <param name="vehicle">The vehicle to attach to command.</param>
        /// <param name="command">The command key value.</param>
        /// <returns>The vehicle command.</returns>
        public static VehicleCommand Build(IVehicleCommands vehicle, char command)
        {
            VehicleCommand result = null;

            switch (char.ToUpper(command))
            {
            case 'A':
                result = new VehicleAdvanceCommand(vehicle);
                break;

            case 'L':
                result = new VehicleTurnLeftCommand(vehicle);
                break;

            case 'R':
                result = new VehicleTurnRightCommand(vehicle);
                break;

            default:
                throw new InvalidCommandException(command);
            }

            return(result);
        }
Esempio n. 3
0
 public GetVehiclesController(IVehicleCommands vehicleCommands, IVehicleQueries vehicleQueries, IVehicleEntityMapper entityMapper)
 {
     _vehicleCommands = vehicleCommands;
     _vehicleQueries  = vehicleQueries;
     _entityMapper    = entityMapper;
 }
Esempio n. 4
0
 public VehicleCommandsTests()
 {
     _vehicleCommands = new VehicleCommands();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="VehicleTurnRightCommand"/> class.
 /// </summary>
 /// <param name="vehicle">The vehicle to apply the commands.</param>
 public VehicleTurnRightCommand(IVehicleCommands vehicle)
     : base(vehicle)
 {
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VehicleCommand"/> class.
 /// </summary>
 /// <param name="vehicle">The vehicle to apply the commands.</param>
 protected VehicleCommand(IVehicleCommands vehicle)
 {
     this.vehicle = vehicle;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="VehicleAdvanceCommand"/> class.
 /// </summary>
 /// <param name="vehicle">The vehicle to apply the commands.</param>
 public VehicleAdvanceCommand(IVehicleCommands vehicle)
     : base(vehicle)
 {
 }
Esempio n. 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VehicleTurnLeftCommand"/> class.
 /// </summary>
 /// <param name="vehicle">The vehicle to apply the commands.</param>
 public VehicleTurnLeftCommand(IVehicleCommands vehicle)
     : base(vehicle)
 {
 }