public void SetUp()
        {
            _clientAccountsService = Mock.Of <IClientAccountService>(r =>
                                                                     r.GetMarginEnabledAsync("id of client") == Task.FromResult(new MarginEnabledSettingsModel()));
            var publisher = Mock.Of <IMessageProducer <MarginTradingEnabledChangedMessage> >();

            Mock.Get(publisher)
            .Setup(s => s.ProduceAsync(It.IsNotNull <MarginTradingEnabledChangedMessage>()))
            .Returns(Task.CompletedTask).Callback <MarginTradingEnabledChangedMessage>(m => _sentMessage = m);
            var expectedRabbitMqSettings = new RabbitMqSettings
            {
                ConnectionString = "conn str",
                ExchangeName     = "exchange name"
            };
            var rabbitMqService = Mock.Of <IRabbitMqService>(s =>
                                                             s.GetProducer(expectedRabbitMqSettings.Equivalent(), true,
                                                                           s.GetJsonSerializer <MarginTradingEnabledChangedMessage>()) ==
                                                             publisher);

            _marginSettings = new MarginTradingSettings
            {
                MtRabbitMqConnString = "conn str",
                RabbitMqQueues       = new RabbitMqQueues
                {
                    MarginTradingEnabledChanged = new RabbitMqQueueInfo {
                        ExchangeName = "exchange name"
                    }
                }
            };

            _marginTradingSettingsCacheService = Mock.Of <IMarginTradingSettingsCacheService>();
            _sut = new MarginTradingEnablingService(_clientAccountsService, rabbitMqService, _marginSettings,
                                                    _marginTradingSettingsCacheService);
            _sut.Start();
        }
 public MarginTradingEnabledFilter(
     IMarginTradingSettingsCacheService marginTradingSettingsCacheService,
     ICacheProvider cacheProvider)
 {
     _marginTradingSettingsCacheService = marginTradingSettingsCacheService;
     _cacheProvider = cacheProvider;
 }
Exemple #3
0
 public Application(IRabbitMqService rabbitMqService, DataReaderSettings dataReaderSettings,
                    IMarginTradingSettingsCacheService marginTradingSettingsCacheService)
 {
     _rabbitMqService    = rabbitMqService;
     _dataReaderSettings = dataReaderSettings;
     _marginTradingSettingsCacheService = marginTradingSettingsCacheService;
     ;
 }
 public MarginTradingEnablingService(IClientAccountService clientAccountService, IRabbitMqService rabbitMqService,
                                     MarginTradingSettings settings,
                                     IMarginTradingSettingsCacheService marginTradingSettingsCacheService)
 {
     _marginSettings       = settings;
     _rabbitMqService      = rabbitMqService;
     _clientAccountService = clientAccountService;
     _marginTradingSettingsCacheService = marginTradingSettingsCacheService;
 }
Exemple #5
0
 public WatchListService(
     IHttpRequestService httpRequestService,
     IMarginTradingWatchListRepository watchListRepository,
     IMarginTradingSettingsCacheService marginTradingSettingsCacheService)
 {
     _httpRequestService  = httpRequestService;
     _watchListRepository = watchListRepository;
     _marginTradingSettingsCacheService = marginTradingSettingsCacheService;
 }
 public MarginTradingEnabledFilter(
     MarginSettings marginSettings,
     IMarginTradingSettingsCacheService marginTradingSettingsCacheService,
     ICacheProvider cacheProvider,
     ILog log)
 {
     _marginSettings = marginSettings;
     _marginTradingSettingsCacheService = marginTradingSettingsCacheService;
     _cacheProvider = cacheProvider;
     _log           = log;
 }
Exemple #7
0
 public RpcFacade(
     MtFrontendSettings settings,
     IHttpRequestService httpRequestService,
     IMarginTradingSettingsCacheService marginTradingSettingsCacheService,
     IMtDataReaderClientsPair dataReaderClients)
 {
     _settings           = settings;
     _httpRequestService = httpRequestService;
     _marginTradingSettingsCacheService = marginTradingSettingsCacheService;
     _dataReaderClients = dataReaderClients;
 }
Exemple #8
0
 public RabbitMqHandler(
     IWampHostedRealm realm,
     IClientAccountService clientNotificationService,
     IMarginTradingOperationsLogService operationsLogService,
     MtFrontendSettings settings,
     IConsole consoleWriter,
     ILog log,
     IMarginTradingSettingsCacheService marginTradingSettingsCacheService)
 {
     _realm = realm;
     _clientNotificationService = clientNotificationService;
     _operationsLog             = operationsLogService;
     _settings      = settings;
     _consoleWriter = consoleWriter;
     _log           = log;
     _marginTradingSettingsCacheService = marginTradingSettingsCacheService;
     _allPairsSubject = realm.Services.GetSubject <BidAskPairRabbitMqContract>(WampConstants.PricesTopicPrefix);
     _tradesSubject   = realm.Services.GetSubject <TradeClientContract>(WampConstants.TradesTopic);
 }
Exemple #9
0
 public SettingsController(Settings.DataReaderSettings dataReaderSettings,
                           IMarginTradingSettingsCacheService marginTradingSettingsCacheService)
 {
     _dataReaderSettings = dataReaderSettings;
     _marginTradingSettingsCacheService = marginTradingSettingsCacheService;
 }