public void Register(IObjectContainer objectContainer) { objectContainer.RegisterInstanceAs(Mock.Of <IServiceProvider>()); objectContainer.RegisterInstanceAs(Mock.Of <IObjectStorage>()); objectContainer.RegisterTypeAs <JsonObjectSerializer, IObjectSerializer>(); objectContainer.RegisterTypeAs <GroupTransactionExecutionService, IGroupTransactionExecutionService>(); RegisterHandlers(objectContainer); objectContainer.RegisterInstanceAs <ICache>(new InMemoryCache()); objectContainer.RegisterTypeAs <MessageTypeService, IMessageTypeService>(); InMemoryTestHarness bus = new InMemoryTestHarness(); bus.AddConsumer <IGroupTransactionEvent>(objectContainer); bus.AddConsumer <IMockEventOne>(objectContainer); bus.AddConsumer <IMockEventTwo>(objectContainer); bus.AddConsumer <IMockEventThree>(objectContainer); bus.AddConsumer <IMockEventFour>(objectContainer); bus.Start().GetAwaiter().GetResult(); objectContainer.RegisterInstanceAs <InMemoryTestHarness>(bus); objectContainer.RegisterInstanceAs <IServiceBus>(new ServiceBus( bus.BusControl, Mock.Of <IContractValidatorService>(), objectContainer.Resolve <IBigMessageService>(), objectContainer.Resolve <ObjectStorageConfiguration>())); }
public void Register(IObjectContainer objectContainer) { objectContainer.RegisterInstanceAs(Mock.Of <IServiceProvider>()); objectContainer.RegisterInstanceAs(Mock.Of <IObjectStorage>()); objectContainer.RegisterTypeAs <JsonObjectSerializer, IObjectSerializer>(); objectContainer.RegisterTypeAs <GroupTransactionExecutionService, IGroupTransactionExecutionService>(); objectContainer.RegisterTypeAs <ClashExceptionValidations, IClashExceptionValidations>(); objectContainer.RegisterInstanceAs <ICache>(new InMemoryCache()); objectContainer.RegisterTypeAs <MessageTypeService, IMessageTypeService>(); RegisterHandlers(objectContainer); InMemoryTestHarness bus = new InMemoryTestHarness(); bus.AddConsumer <IGroupTransactionEvent>(objectContainer); bus.AddConsumer <IBulkClashCreatedOrUpdated>(objectContainer); bus.AddConsumer <IBulkClashDeleted>(objectContainer); bus.AddConsumer <IClashUpdated>(objectContainer); bus.AddConsumer <IClashTruncated>(objectContainer); bus.AddConsumer <IBulkBreakCreated>(objectContainer); bus.AddConsumer <IBulkBreaksDeleted>(objectContainer); bus.AddConsumer <IBulkProductCreatedOrUpdated>(objectContainer); bus.AddConsumer <IBulkProductDeleted>(objectContainer); bus.AddConsumer <IBulkHolidayCreated>(objectContainer); bus.AddConsumer <IBulkHolidayDeleted>(objectContainer); bus.AddConsumer <IDemographicUpdated>(objectContainer); bus.AddConsumer <IBulkDemographicDeleted>(objectContainer); bus.AddConsumer <IBulkDemographicCreatedOrUpdated>(objectContainer); bus.AddConsumer <IBulkProgrammeCreated>(objectContainer); bus.AddConsumer <IBulkProgrammeUpdated>(objectContainer); bus.AddConsumer <IBulkProgrammeDeleted>(objectContainer); bus.AddConsumer <IBulkProgrammeClassificationCreated>(objectContainer); bus.AddConsumer <IDeleteAllProgrammeClassification>(objectContainer); bus.AddConsumer <IBulkUniverseCreated>(objectContainer); bus.AddConsumer <IBulkUniverseDeleted>(objectContainer); bus.AddConsumer <IBulkRestrictionCreatedOrUpdated>(objectContainer); bus.AddConsumer <IBulkRestrictionDeleted>(objectContainer); bus.AddConsumer <IBulkSpotCreatedOrUpdated>(objectContainer); bus.AddConsumer <IBulkSpotDeleted>(objectContainer); bus.AddConsumer <IBulkRatingsPredictionSchedulesCreated>(objectContainer); bus.AddConsumer <IBulkRatingsPredictionSchedulesDeleted>(objectContainer); bus.AddConsumer <IBulkSalesAreaCreatedOrUpdated>(objectContainer); bus.AddConsumer <IBulkSalesAreaDeleted>(objectContainer); bus.AddConsumer <ISalesAreaUpdated>(objectContainer); bus.AddConsumer <IBulkClashExceptionCreated, BulkClashExceptionCreatedValidator>(objectContainer); bus.AddConsumer <IBulkClashExceptionDeleted, BulkClashExceptionDeletedValidator>(objectContainer); bus.AddConsumer <IBulkCampaignCreatedOrUpdated>(objectContainer); bus.AddConsumer <IBulkCampaignDeleted>(objectContainer); bus.AddConsumer <IBulkBookingPositionGroupCreated>(objectContainer); bus.AddConsumer <IBulkBookingPositionGroupDeleted>(objectContainer); bus.AddConsumer <IBookingPositionGroupTruncated>(objectContainer); bus.AddConsumer <IBulkProgrammeCategoryCreated>(objectContainer); bus.AddConsumer <IBulkProgrammeCategoryDeleted>(objectContainer); bus.AddConsumer <IBulkLockTypeCreated>(objectContainer); bus.AddConsumer <IBulkLockTypeDeleted>(objectContainer); bus.AddConsumer <IBulkInventoryTypeCreated>(objectContainer); bus.AddConsumer <IBulkInventoryTypeDeleted>(objectContainer); bus.AddConsumer <IBulkInventoryLockCreated>(objectContainer); bus.AddConsumer <IBulkInventoryLockDeleted>(objectContainer); bus.AddConsumer <IBulkTotalRatingCreated>(objectContainer); bus.AddConsumer <IBulkTotalRatingDeleted>(objectContainer); bus.AddConsumer <IBulkBreakTypeCreated>(objectContainer); bus.AddConsumer <IBulkBreakTypeDeleted>(objectContainer); bus.AddConsumer <IBulkStandardDayPartCreated>(objectContainer); bus.AddConsumer <IBulkStandardDayPartDeleted>(objectContainer); bus.AddConsumer <IBulkStandardDayPartGroupCreated>(objectContainer); bus.AddConsumer <IBulkStandardDayPartGroupDeleted>(objectContainer); bus.AddConsumer <IBulkSpotBookingRuleCreated>(objectContainer); bus.AddConsumer <IBulkSpotBookingRuleDeleted>(objectContainer); bus.AddConsumer <IBulkLengthFactorCreated>(objectContainer); bus.AddConsumer <IBulkLengthFactorDeleted>(objectContainer); Task.WaitAll(bus.Start()); objectContainer.RegisterInstanceAs <InMemoryTestHarness>(bus); objectContainer.RegisterInstanceAs <IServiceBus>(new ServiceBus( bus.BusControl, Mock.Of <IContractValidatorService>(), objectContainer.Resolve <IBigMessageService>(), objectContainer.Resolve <ObjectStorageConfiguration>())); }