Exemplo n.º 1
0
        public void Setup()
        {
            _alertStream        = A.Fake <IUniverseAlertStream>();
            _equitiesParameters = A.Fake <IHighVolumeRuleEquitiesParameters>();
            _ruleCtx            = A.Fake <ISystemProcessOperationRunRuleContext>();
            _opCtx = A.Fake <ISystemProcessOperationContext>();
            _dataRequestRepository     = A.Fake <IRuleRunDataRequestRepository>();
            _stubDataRequestRepository = A.Fake <IStubRuleRunDataRequestRepository>();

            _equityFactoryCache = A.Fake <ILogger <UniverseEquityMarketCacheFactory> >();
            _equityFactory      = new UniverseEquityMarketCacheFactory(_stubDataRequestRepository, _dataRequestRepository, _equityFactoryCache);

            _fixedIncomeFactoryCache = A.Fake <ILogger <UniverseFixedIncomeMarketCacheFactory> >();
            _fixedIncomeFactory      = new UniverseFixedIncomeMarketCacheFactory(_stubDataRequestRepository, _dataRequestRepository, _fixedIncomeFactoryCache);

            _tradingHoursService          = A.Fake <IMarketTradingHoursService>();
            _dataRequestSubscriber        = A.Fake <IUniverseDataRequestsSubscriber>();
            this.currencyConverterService = A.Fake <ICurrencyConverterService>();
            _logger        = A.Fake <ILogger <IHighVolumeRule> >();
            _tradingLogger = A.Fake <ILogger <TradingHistoryStack> >();

            _orderFilter = A.Fake <IUniverseOrderFilter>();
            A.CallTo(() => _orderFilter.Filter(A <IUniverseEvent> .Ignored)).ReturnsLazily(i => (IUniverseEvent)i.Arguments[0]);

            A.CallTo(() => _ruleCtx.EndEvent()).Returns(_opCtx);
        }
        public void Setup()
        {
            _logger             = A.Fake <ILogger>();
            _tradingLogger      = A.Fake <ILogger <TradingHistoryStack> >();
            _alertStream        = A.Fake <IUniverseAlertStream>();
            _ruleCtx            = A.Fake <ISystemProcessOperationRunRuleContext>();
            _operationCtx       = A.Fake <ISystemProcessOperationContext>();
            _equitiesParameters = new LayeringRuleEquitiesParameters("id", TimeSpan.FromMinutes(30), 0.2m, null, null, null, false, true);

            _orderFilter = A.Fake <IUniverseOrderFilter>();
            A.CallTo(() => _orderFilter.Filter(A <IUniverseEvent> .Ignored)).ReturnsLazily(i => (IUniverseEvent)i.Arguments[0]);

            _ruleRunRepository        = A.Fake <IRuleRunDataRequestRepository>();
            _stubRuleRunRepository    = A.Fake <IStubRuleRunDataRequestRepository>();
            _equityFactoryLogger      = A.Fake <ILogger <UniverseEquityMarketCacheFactory> >();
            _equityFactory            = new UniverseEquityMarketCacheFactory(_stubRuleRunRepository, _ruleRunRepository, _equityFactoryLogger);
            _fixedIncomeFactoryLogger = A.Fake <ILogger <UniverseFixedIncomeMarketCacheFactory> >();
            _fixedIncomeFactory       = new UniverseFixedIncomeMarketCacheFactory(_stubRuleRunRepository, _ruleRunRepository, _fixedIncomeFactoryLogger);
            _tradingHoursService      = A.Fake <IMarketTradingHoursService>();

            _tradingHoursRepository = A.Fake <IMarketOpenCloseApiCachingDecorator>();
            A.CallTo(() => _tradingHoursRepository.GetAsync())
            .Returns(
                new ExchangeDto[]
            {
                new ExchangeDto
                {
                    Code              = "XLON",
                    MarketOpenTime    = TimeSpan.FromHours(8),
                    MarketCloseTime   = TimeSpan.FromHours(16),
                    IsOpenOnMonday    = true,
                    IsOpenOnTuesday   = true,
                    IsOpenOnWednesday = true,
                    IsOpenOnThursday  = true,
                    IsOpenOnFriday    = true,
                    IsOpenOnSaturday  = true,
                    IsOpenOnSunday    = true,
                }
            });

            A.CallTo(() => _ruleCtx.EndEvent()).Returns(_operationCtx);
        }