Example #1
0
        public void Initialize()
        {
            _sut = new CabRideMapper();

            _command = _fixture.Create <DriveCustomerToTrainStation>();
            _ex      = _fixture.Create <Exception>();
        }
Example #2
0
        public Location MapToCustomerLocation(DriveCustomerToTrainStation driveCustomerToTrainStation)
        {
            var @long = driveCustomerToTrainStation.CurrentLongitude;
            var lat   = driveCustomerToTrainStation.CurrentLatitude;

            return(new Location(@long, lat));
        }
Example #3
0
        public async Task WhenNoCommand_ShouldThrowArgumentNullException()
        {
            // Arrange
            DriveCustomerToTrainStation command = null;

            // Act
            Func <Task> act = async() => await _sut.Post(command);

            // Assert
            act.Should().Throw <ArgumentNullException>();
        }
Example #4
0
        public void WhenNoCommand_ShouldThrowArgumentNullException()
        {
            // Arrange
            DriveCustomerToTrainStation command = null;

            // Act
            Action act = () => _sut.MapFailedEvent(command, _ex);

            // Assert
            act.Should().Throw <ArgumentNullException>();
        }
Example #5
0
        public DriveCustomerToTrainStationFailed MapFailedEvent(DriveCustomerToTrainStation command, Exception exception)
        {
            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            if (exception == null)
            {
                throw new ArgumentNullException(nameof(exception));
            }

            return(new DriveCustomerToTrainStationFailed
            {
                Reason = exception.ToString()
            });
        }
 public void CreateCustomer()
 {
     _command = _fixture.Create <DriveCustomerToTrainStation>();
     _command.CurrentLatitude  = _customerLocation.Latitude;
     _command.CurrentLongitude = _customerLocation.Longitude;
 }
Example #7
0
 public Id <Customer> MapToCustomerId(DriveCustomerToTrainStation driveCustomerToTrainStation)
 {
     return(Id <Customer> .Create(driveCustomerToTrainStation.CustomerId));
 }
Example #8
0
 public Id <Customer> MapToCustomerId(DriveCustomerToTrainStation driveCustomerToTrainStation)
 {
     return(new Id <Customer>(driveCustomerToTrainStation.CustomerId));
 }