using Calculator;

namespace CalcTDD
{
    public class Program
    {
        [Fact]
        public void GIVEN_two_positive_numbers_WHEN_run_sum_THEN_return_positive()
        {
            // Arrange
            string input = "+ 1 2";
            double actual = 0;
            int expected = 3;
            CalculatorPolska calculatorPolska = new CalculatorPolska();

            // Act
            actual = calculatorPolska.Calculate(input);

            // Assert
            Assert.Equal(expected, actual);

        }

        [Fact]
        public void GIVEN_two_positive_numbers_WHEN_run_sub_THEN_return_positive()
        {
            // Arrange
            string input = "- 3 2";
            double actual = 0;
            int expected = 1;
            CalculatorPolska calculatorPolska = new CalculatorPolska();

            // Act
            actual = calculatorPolska.Calculate(input);

            // Assert
            Assert.Equal(expected, actual);

        }

        [Fact]
        public void GIVEN_two_positive_numbers_WHEN_run_mul_THEN_return_positive()
        {
            // Arrange
            string input = "* 3 2";
            double actual = 0;
            int expected = 6;
            CalculatorPolska calculatorPolska = new CalculatorPolska();

            // Act
            actual = calculatorPolska.Calculate(input);

            // Assert
            Assert.Equal(expected, actual);

        }

        [Fact]
        public void GIVEN_two_positive_numbers_WHEN_run_div_THEN_return_positive()
        {
            // Arrange
            string input = "/ 4 2";
            double actual = 0;
            double expected = 2;
            CalculatorPolska calculatorPolska = new CalculatorPolska();

            // Act
            actual = calculatorPolska.Calculate(input);

            // Assert
            Assert.Equal(expected, actual);

        }

        [Fact]
        public void GIVEN_three_positive_numbers_WHEN_run_sum_sum_THEN_return_positive()
        {
            // Arrange
            string input = "+ + 1 2 3";
            double actual = 0;
            int expected = 6;
            CalculatorPolska calculatorPolska = new CalculatorPolska();

            // Act
            actual = calculatorPolska.Calculate(input);

            // Assert
            Assert.Equal(expected, actual);

        }

        [Fact]
        public void GIVEN_three_positive_numbers_WHEN_run_sum_div_THEN_return_positive()
        {
            // Arrange
            string input = "+ - 1 2 3";
            double actual = 0;
            int expected = 2;
            CalculatorPolska calculatorPolska = new CalculatorPolska();

            // Act
            actual = calculatorPolska.Calculate(input);

            // Assert
            Assert.Equal(expected, actual);

        }

        [Fact]
        public void GIVEN_three_positive_numbers_WHEN_run_div_div_THEN_return_positive()
        {
            // Arrange
            string input = "- - 7 2 3";
            double actual = 0;
            int expected = 2;
            CalculatorPolska calculatorPolska = new CalculatorPolska();

            // Act
            actual = calculatorPolska.Calculate(input);

            // Assert
            Assert.Equal(expected, actual);

        }

        [Fact]
        public void GIVEN_three_positive_numbers_WHEN_run_div_mul_THEN_return_positive()
        {
            // Arrange
            string input = "- 7 * 2 3";
            double actual = 0;
            int expected = 1;
            CalculatorPolska calculatorPolska = new CalculatorPolska();

            // Act
            actual = calculatorPolska.Calculate(input);

            // Assert
            Assert.Equal(expected, actual);

        }


        [Theory]
        [InlineData("- - - - 5 1 1 1 1", 1)]
        [InlineData("+ + + - 5 1 1 2 2", 9)]
        [InlineData("+ + + 5 1 1 * 2 2", 11)]
        [InlineData("+ - - 5 7 6 / 4 2", -6)]
        [InlineData("- - - - 9 2 2 2 2", 1)]
        [InlineData("+ + + ^ 5 2 2 2 1", 30)]
        [InlineData("+ / - 25 4 7 * 5 - 12 3", 48)]
        [InlineData("+ * / 14 2 - 17 8 3", 66)]

        public void GIVEN_many_positive_numbers_WHEN_run_many_operators_THEN_return_positive(
            string input,
            double expected
            )
        {
            // Arrange
            double actual = 0;
            CalculatorPolska calculatorPolska = new CalculatorPolska();

            // Act
            actual = calculatorPolska.Calculate(input);

            // Assert
            Assert.Equal(expected, actual);

        }

    }

}