コード例 #1
0
        public void AppendCandleStick(CandleStick candleStick)
        {
            if (HasMaxCandleSticks())
            {
                throw CandleStickExceptions.MaxNumberOfCandleSticks(this.GetType(), _MaxNumberOfCandleSticks);
            }

            _CandleSticks.Add(candleStick);
        }
コード例 #2
0
        public void Test_MaxNumberOfCandleSticks()
        {
            const int maxNumberOfCandleSticks = 3;
            var       strategyType            = typeof(IStrategy);

            var exception = CandleStickExceptions.MaxNumberOfCandleSticks(strategyType, maxNumberOfCandleSticks);

            Assert.Equal($"Max number of candle sticks for {strategyType} is {maxNumberOfCandleSticks}", exception.Message);
            Assert.Equal(typeof(OverflowException), exception.GetType());
        }