public void Initialize()
 {
     _messageBus     = Substitute.For <IQueue>();
     _cabRideService = Substitute.For <ICabRideService>();
     _driveCustomerToTrainStationMapper = Substitute.For <IDriveCustomerToTrainStationMapper>();
     _cabRideMapper = Substitute.For <ICabRideMapper>();
 }
        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);
        }
Esempio n. 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 WhenNoCabRideService_ShouldThrowArgumentNullException()
        {
            // Arrange
            ICabRideService cabRideService = null;

            // Act
            Action act = () => new DriveCustomerToTrainStationHandler(_messageBus, cabRideService, _driveCustomerToTrainStationMapper, _cabRideMapper);

            // Assert
            act.Should().Throw <ArgumentNullException>();
        }
Esempio n. 5
0
        public void Initialize()
        {
            _bus = Substitute.For <IBus>();

            _cabRideService = Substitute.For <ICabRideService>();
            _cabRideService
            .BringCustomerToTheTrainStation(Arg.Any <Id <Customer> >(), Arg.Any <Location>())
            .Returns(_fixture.Create <Ride>());

            // Bootstrap
            var serviceProvider = new ServiceCollection()
                                  .UseDispatchingBroker()
                                  .AddTransient((s) => _bus)
                                  .AddTransient((s) => _cabRideService)
                                  .BuildServiceProvider();

            _sut = serviceProvider.GetService <DriveCustomerToTrainStationHandler>();
        }
Esempio n. 6
0
 public cabRidesController(ICabRideService cabRideService)
 {
     _cabRideService = cabRideService;
 }