private void AddIndicator(ParameterizedIndicator indicator, InvestmentStrategy investmentStrategy)
        {
            if (!indicator.IndicatorType.HasValue)
            {
                throw new BusinessException("Wrong indicator value");
            }

            var strategyIndicator = new StrategyIndicator
            {
                IndicatorType = (int)indicator.IndicatorType.Value,
                Strategy      = investmentStrategy,
                Properties    = new List <StrategyIndicatorProperty>()
            };

            foreach (var indicatorProperty in indicator.Properties)
            {
                if (
                    _indicatorsService.GetPropertiesForIndicator(indicator.IndicatorType.Value)
                    .All(item => item.Name != indicatorProperty.Name))
                {
                    continue;
                }
                strategyIndicator.Properties.Add(new StrategyIndicatorProperty
                {
                    Indicator = strategyIndicator,
                    Name      = indicatorProperty.Name,
                    Value     = indicatorProperty.Value
                });
            }
            investmentStrategy.Indicators.Add(strategyIndicator);
        }
        public void GetSignals_should_create_indicator_with_custom_properties()
        {
            var indicator = new ParameterizedIndicator
            {
                IndicatorType = IndicatorType.Ema,
                Properties    = new List <IndicatorProperty>
                {
                    new IndicatorProperty {
                        Name = nameof(EmaIndicator.Term), Value = 10
                    }
                }
            };

            _factory.Setup(f => f.CreateIndicator(IndicatorType.Ema, new Dictionary <string, int> {
                { nameof(EmaIndicator.Term), 10 }
            }))
            .Returns(new EmaIndicator {
                Term = 10
            });

            _service.GetSignals(new DateTime(2016, 1, 1), new DateTime(2016, 1, 30), new List <int> {
                1
            },
                                new List <ParameterizedIndicator> {
                indicator
            });

            _factory.Verify(f => f.CreateIndicator(IndicatorType.Ema, new Dictionary <string, int> {
                { nameof(EmaIndicator.Term), 10 }
            }));
        }