예제 #1
0
        public int Add(int x, int y)
        {
            if ((x >= int.MaxValue && y > 0) || (y >= int.MaxValue && x > 0) ||
                (x <= int.MinValue && y < 0) || (y <= int.MinValue && x < 0))
            {
                throw new OverflowException($"Cannot add {x} and {y} as its result is large");
            }

            _persister.PersistOperation($"{x} + {y}");
            _logger.Log($"Adding two values <{x}> and <{y}>");
            return(x + y);
        }