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() { _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>(); }