public void AppendCandleStick(CandleStick candleStick) { if (HasMaxCandleSticks()) { throw CandleStickExceptions.MaxNumberOfCandleSticks(this.GetType(), _MaxNumberOfCandleSticks); } _CandleSticks.Add(candleStick); }
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()); }