Exemple #1
0
 public void ShouldReturnErrorWhenThereIsAnyInvalidChar()
 {
     Assert.Throws <ApplicationException>(() => ReversePolishNotationCalculator.Calculate("51,"));
 }
Exemple #2
0
 public void ShouldReturnErrorWhenThereAreNumbersWithoutBeenEvaluated()
 {
     Assert.Throws <ApplicationException>(() => ReversePolishNotationCalculator.Calculate("123+"));
 }
Exemple #3
0
        public void ShouldReturn1()
        {
            var actual = ReversePolishNotationCalculator.Calculate("51-2+5*33333++++/1-");

            Assert.That(actual, Is.EqualTo(1));
        }
Exemple #4
0
 public void ShouldReturnErrorWhenTheAmountOfOperatorsIsBiggerThanTheAmountOfNumbers()
 {
     Assert.Throws <ApplicationException>(() => ReversePolishNotationCalculator.Calculate("22+++"));
 }
Exemple #5
0
        public void ShouldReturn17()
        {
            var actual = ReversePolishNotationCalculator.Calculate("512+5*+3-");

            Assert.That(actual, Is.EqualTo(17));
        }