public void ConvertInfixToPostfix()
        {
            // Arrange
            string formula = "-6/-(-1-5)+-1";
            InfixToPostfixConverter i2p = new InfixToPostfixConverter(new Tokenizer());

            // Act
            string result = i2p.Convert(formula);

            // Assert
            Assert.AreEqual("6 m 1 m 5 - m / 1 m +", result, string.Format("Conversion of \"{0}\" failed!", formula));

            // Arrange
            formula = "-6/-(-1-5)++1";

            // Act
            result = i2p.Convert(formula);

            // Assert
            Assert.AreEqual("6 m 1 m 5 - m / 1 p +", result, string.Format("Conversion of \"{0}\" failed!", formula));

            // Arrange
            formula = "3 + 4 * 2 / (1 - 5) ^ 2 ^ 3";

            // Act
            result = i2p.Convert(formula);

            // Assert
            Assert.AreEqual("3 4 2 * 1 5 - 2 3 ^ ^ / +", result, string.Format("Conversion of \"{0}\" failed!", formula));

            // Arrange
            formula = "1+(1)+(1)+1";

            // Act
            result = i2p.Convert(formula);

            // Assert
            Assert.AreEqual("1 1 + 1 + 1 +", result, string.Format("Conversion of \"{0}\" failed!", formula));

            // Arrange
            formula = "1+(-1)+(-1)+1";

            // Act
            result = i2p.Convert(formula);

            // Assert
            Assert.AreEqual("1 1 m + 1 m + 1 +", result, string.Format("Conversion of \"{0}\" failed!", formula));

            // Arrange
            formula = "(1)-(-1)";

            // Act
            result = i2p.Convert(formula);

            // Assert
            Assert.AreEqual("1 1 m -", result, string.Format("Conversion of \"{0}\" failed!", formula));
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                ShowTokens();

                InfixToPostfixConverter conv = new InfixToPostfixConverter(new Tokenizer());
                var postfix = conv.Convert(tbSource.Text);
                tbPostfix.Text = postfix;

                PostfixEvaluator eva = new PostfixEvaluator();
                var result = eva.Evaluate(postfix);
                tbResult.Text = result.ToString();
            }
            catch (Exception ex)
            {
                tbResult.Text = string.Format("Error: {0}{1}", ex.Message, Environment.NewLine);
                tbTokenOutput.AppendText(tbResult.Text);
            }
        }