protected override void Load(ContainerBuilder builder) { var watchListRepository = MarginTradingTestsUtils.GetPopulatedMarginTradingWatchListsRepository(); builder.RegisterInstance(new LogToMemory()).As <ILog>(); builder.RegisterInstance(watchListRepository).As <IMarginTradingWatchListRepository>().SingleInstance(); }
protected override void Load(ContainerBuilder builder) { var assets = MarginTradingTestsUtils.GetPopulatedAssets(); var assetPairs = MarginTradingTestsUtils.GetPopulatedAssetPairs(); var tradingConditions = MarginTradingTestsUtils.GetPopulatedTradingConditions(); var tradingInstruments = MarginTradingTestsUtils.GetPopulatedTradingInstruments(); var meRoutes = MarginTradingTestsUtils.GetPopulatedMatchingEngineRoutes(); var accountApi = MarginTradingTestsUtils.GetPopulatedAccountsApi(_accounts); var accountBalanceHistoryApi = MarginTradingTestsUtils.GetPopulatedAccountBalanceHistoryApi(); var brokerSettingsApi = MarginTradingTestsUtils.GetBrokerSettingsApi(_brokerId); var featureManager = MarginTradingTestsUtils.GetFeatureManager(_brokerId, brokerSettingsApi); builder.RegisterInstance(new CorrelationContextAccessor()).AsSelf(); builder.RegisterInstance(new LogToMemory()).As <ILog>(); builder.RegisterInstance(assets).As <IAssetsApi>().SingleInstance(); builder.RegisterInstance(brokerSettingsApi).As <IBrokerSettingsApi>().SingleInstance(); builder.RegisterInstance(featureManager).As <IFeatureManager>().SingleInstance(); builder.RegisterInstance(assetPairs).As <IAssetPairsApi>().SingleInstance(); builder.RegisterInstance(tradingConditions).As <ITradingConditionsApi>().SingleInstance(); builder.RegisterInstance(tradingInstruments).As <ITradingInstrumentsApi>().SingleInstance(); builder.RegisterInstance(meRoutes).As <ITradingRoutesApi>().SingleInstance(); builder.RegisterInstance(accountApi).As <IAccountsApi>().SingleInstance(); builder.RegisterInstance(accountBalanceHistoryApi).As <IAccountBalanceHistoryApi>().SingleInstance(); builder.RegisterInstance(Mock.Of <IOrderBookProviderApi>(x => x.GetOrderBooks(null) == Task.FromResult(new List <ExternalOrderBookContract>()))); builder.RegisterInstance(Mock.Of <IClientProfileSettingsApi>()).As <IClientProfileSettingsApi>().SingleInstance(); }
protected override void Load(ContainerBuilder builder) { var assetsService = MarginTradingTestsUtils.GetPopulatedAssetsService(); var accountRepository = MarginTradingTestsUtils.GetPopulatedAccountsRepository(_accounts); var conditionsRepository = MarginTradingTestsUtils.GetPopulatedMarginTradingConditionsRepository(); var accountGroupRepository = MarginTradingTestsUtils.GetPopulatedAccountGroupRepository(); var accountAssetsRepository = MarginTradingTestsUtils.GetPopulatedAccountAssetsRepository(); var meRoutesRepository = MarginTradingTestsUtils.GetPopulatedMatchingEngineRoutesRepository(); var overnightSwapStateRepository = MarginTradingTestsUtils.GetOvernightSwapStateRepository(); var overnightSwapHistoryRepository = MarginTradingTestsUtils.GetOvernightSwapHistoryRepository(); var blobRepository = new Mock <IMarginTradingBlobRepository>(); var orderHistoryRepository = new Mock <IMarginTradingOrdersHistoryRepository>(); var riskSystemCommandsLogRepository = new Mock <IRiskSystemCommandsLogRepository>(); var assetPairSettingsRepository = new Mock <IAssetPairSettingsRepository>(); assetPairSettingsRepository.Setup(s => s.GetAsync()).ReturnsAsync(new List <IAssetPairSettings>()); builder.RegisterInstance(new LogToMemory()).As <ILog>(); builder.RegisterInstance(assetsService).As <IAssetsService>().SingleInstance(); builder.RegisterInstance(accountRepository).As <IMarginTradingAccountsRepository>().SingleInstance(); builder.RegisterInstance( new MarginTradingAccountStatsRepository(new NoSqlTableInMemory <MarginTradingAccountStatsEntity>())) .As <IMarginTradingAccountStatsRepository>().SingleInstance(); builder.RegisterInstance(conditionsRepository).As <ITradingConditionRepository>().SingleInstance(); builder.RegisterInstance(accountGroupRepository).As <IAccountGroupRepository>() .SingleInstance(); builder.RegisterInstance(accountAssetsRepository).As <IAccountAssetPairsRepository>().SingleInstance(); builder.RegisterInstance(meRoutesRepository).As <IMatchingEngineRoutesRepository>().SingleInstance(); builder.RegisterInstance(overnightSwapStateRepository).As <IOvernightSwapStateRepository>().SingleInstance(); builder.RegisterInstance(overnightSwapHistoryRepository).As <IOvernightSwapHistoryRepository>() .SingleInstance(); builder.RegisterType <MatchingEngineInMemoryRepository>().As <IMatchingEngineRepository>().SingleInstance(); //mocks builder.RegisterInstance(blobRepository.Object).As <IMarginTradingBlobRepository>().SingleInstance(); builder.RegisterInstance(orderHistoryRepository.Object).As <IMarginTradingOrdersHistoryRepository>() .SingleInstance(); builder.RegisterInstance(riskSystemCommandsLogRepository.Object).As <IRiskSystemCommandsLogRepository>() .SingleInstance(); builder.Register <IDayOffSettingsRepository>(c => new DayOffSettingsRepository(blobRepository.Object)) .SingleInstance(); builder.RegisterInstance(assetPairSettingsRepository.Object) .As <IAssetPairSettingsRepository>().SingleInstance(); }
protected override void Load(ContainerBuilder builder) { var assets = MarginTradingTestsUtils.GetPopulatedAssets(); var assetPairs = MarginTradingTestsUtils.GetPopulatedAssetPairs(); var tradingConditions = MarginTradingTestsUtils.GetPopulatedTradingConditions(); var tradingInstruments = MarginTradingTestsUtils.GetPopulatedTradingInstruments(); var meRoutes = MarginTradingTestsUtils.GetPopulatedMatchingEngineRoutes(); var accountApi = MarginTradingTestsUtils.GetPopulatedAccountsApi(_accounts); builder.RegisterInstance(new LogToMemory()).As <ILog>(); builder.RegisterInstance(assets).As <IAssetsApi>().SingleInstance(); builder.RegisterInstance(assetPairs).As <IAssetPairsApi>().SingleInstance(); builder.RegisterInstance(tradingConditions).As <ITradingConditionsApi>().SingleInstance(); builder.RegisterInstance(tradingInstruments).As <ITradingInstrumentsApi>().SingleInstance(); builder.RegisterInstance(meRoutes).As <ITradingRoutesApi>().SingleInstance(); builder.RegisterInstance(accountApi).As <IAccountsApi>().SingleInstance(); builder.RegisterInstance(Mock.Of <IOrderBookProviderApi>(x => x.GetOrderBooks(null) == Task.FromResult(new List <ExternalOrderBookContract>()))); }