public void AddOperationRecognition()
        {
            var operation = @"+";

            var provider = new BasicOperationProvider();

            Assert.True(provider.IsOperation(operation));
        }
        public void IncorrectOperationNoRecognition()
        {
            var incorrectOperation = @"#";

            var provider = new BasicOperationProvider();

            Assert.False(provider.IsOperation(incorrectOperation));
        }
        public void DivAndSibCorrectComparsion()
        {
            var div = @"/";
            var sub = @"-";

            var provider = new BasicOperationProvider();

            Assert.True(provider.ComparePriority(div, sub) > 0);
        }
        public void AddAndMulCorrectComparsion()
        {
            var add = @"+";
            var mul = @"*";

            var provider = new BasicOperationProvider();

            Assert.True(provider.ComparePriority(add, mul) < 0);
        }
        public void AddAndSubCorrectComparsion()
        {
            var add = @"+";
            var sub = @"-";

            var provider = new BasicOperationProvider();

            Assert.True(provider.ComparePriority(add, sub) == 0);
        }
        public void ComplexExpressionCorrectCalculation()
        {
            var operationProvider = new BasicOperationProvider();

            var converter = new PostfixConverterSortStation(operationProvider);
            var executor = new PostfixExecutor(operationProvider);

            var input = @"4 * 5 - 27 / 3";

            var calculator = new Calculator(converter, executor);
            var result = calculator.Calculate(input);

            Assert.Equal(11, result);
        }
        public void DivisionByZeroExceptionThrow()
        {
            var operationProvider = new BasicOperationProvider();

            var converter = new PostfixConverterSortStation(operationProvider);
            var executor = new PostfixExecutor(operationProvider);

            var input = @"13 / 0";

            var calculator = new Calculator(converter, executor);

            Assert.Throws(typeof(DivideByZeroException), () =>
            {
                calculator.Calculate(input);
            });
        }
        public void MissingOperandExpressionExceptionThrow()
        {
            var operationProvider = new BasicOperationProvider();

            var converter = new PostfixConverterSortStation(operationProvider);
            var executor = new PostfixExecutor(operationProvider);

            var input = @"2 + + 7";

            var calculator = new Calculator(converter, executor);

            Assert.Throws(typeof(IncorrectExpressionException), () =>
            {
                calculator.Calculate(input);
            });
        }
        public void ComplexExpressionCorrectPostfixString()
        {
            var operationProvider = new BasicOperationProvider();

            var infix = @"3 * 10 - 26 / 13";

            var postfixConverter = new PostfixConverterSortStation(operationProvider);
            var postfix = postfixConverter.Convert(infix);

            Assert.Equal(@"3 10 * 26 13 / -", postfix);
        }
        public void IncorrectCharactersInInputStringExceptionThrow()
        {
            var operationProvider = new BasicOperationProvider();

            var infix = @"2asb + 7";

            var postfixConverter = new PostfixConverterSortStation(operationProvider);

            Assert.Throws(typeof(IncorrectCharacterException), () =>
            {
                postfixConverter.Convert(infix);
            });
        }