public void Initialize()
        {
            _messageBus     = Substitute.For <IQueue>();
            _cabRideService = Substitute.For <ICabRideService>();
            _driveCustomerToTrainStationMapper = Substitute.For <IDriveCustomerToTrainStationMapper>();
            _cabRideMapper = Substitute.For <ICabRideMapper>();

            _driveCustomerToTrainStationMapper
            .MapToCustomerId(Arg.Any <DriveCustomerToTrainStation>())
            .Returns(_fixture.Create <Id <Customer> >());

            _driveCustomerToTrainStationMapper
            .MapToCustomerLocation(Arg.Any <DriveCustomerToTrainStation>())
            .Returns(_fixture.Create <Location>());

            _cabRideMapper
            .MapFailedEvent(Arg.Any <DriveCustomerToTrainStation>(), Arg.Any <Exception>())
            .Returns(_fixture.Create <DriveCustomerToTrainStationFailed>());

            _cabRideMapper
            .MapSuccessEvent(Arg.Any <Ride>())
            .Returns(_fixture.Create <DroveCustomerToTrainStation>());

            _sut = new DriveCustomerToTrainStationHandler(_messageBus, _cabRideService, _driveCustomerToTrainStationMapper, _cabRideMapper);
        }
 public void Initialize()
 {
     _messageBus     = Substitute.For <IQueue>();
     _cabRideService = Substitute.For <ICabRideService>();
     _driveCustomerToTrainStationMapper = Substitute.For <IDriveCustomerToTrainStationMapper>();
     _cabRideMapper = Substitute.For <ICabRideMapper>();
 }
Example #3
0
 public DriveCustomerToTrainStationHandler(IQueue messageBus,
                                           ICabRideService cabRideService,
                                           IDriveCustomerToTrainStationMapper driveCustomerToTrainStationMapper,
                                           ICabRideMapper cabRideMapper)
 {
     _messageBus     = messageBus ?? throw new ArgumentNullException(nameof(messageBus));
     _cabRideService = cabRideService ?? throw new ArgumentNullException(nameof(cabRideService));
     _driveCustomerToTrainStationMapper = driveCustomerToTrainStationMapper ?? throw new ArgumentNullException(nameof(driveCustomerToTrainStationMapper));
     _cabRideMapper = cabRideMapper ?? throw new ArgumentNullException(nameof(cabRideMapper));
 }
        public void WhenNoDriveCustomerToTrainStationMapper_ShouldThrowArgumentNullException()
        {
            // Arrange
            IDriveCustomerToTrainStationMapper driveCustomerToTrainStationMapper = null;

            // Act
            Action act = () => new DriveCustomerToTrainStationHandler(_messageBus, _cabRideService, driveCustomerToTrainStationMapper, _cabRideMapper);

            // Assert
            act.Should().Throw <ArgumentNullException>();
        }