Пример #1
0
        protected virtual void ValidatePosition(RomanCalculator connector)
        {
            var afterNumbers = connector.After(this);

            if (!afterNumbers.IsNullOrEmpty() && !(afterNumbers.All(o => o.Value <= this.Value)))
            {
                throw new Exception($"{this.Symbol} can nerver be subtracted.");
            }
        }
Пример #2
0
        protected override void ValidatePosition(RomanCalculator connector)
        {
            var afterNumbers = connector.After(this);

            if (!afterNumbers.IsNullOrEmpty() && !(afterNumbers.All(o => o.Value <= this.Value || new[] { SymbolEnum.D, SymbolEnum.M }.Contains(o.Symbol))))
            {
                throw new Exception($"{this.Symbol} can be only subtracted from {SymbolEnum.D} {SymbolEnum.M}.");
            }
        }