Beispiel #1
0
        public void when_a_digit_is_sent_it_should_display_the_same_digit([Random(100)] int digit)
        {
            string expression = digit.ToString();

            var result = RPNCalculator.Resolve(expression);

            Check.That(result).IsEqualTo(expression);
        }
Beispiel #2
0
        public void when_some_digits_are_sent_it_should_display_the_number_formed_by_those_digits(
            [Random(10)] int digit1,
            [Random(10)] int digit2)
        {
            string expression = $"{digit1} {digit2}";

            var result = RPNCalculator.Resolve(expression);

            Check.That(result).IsEqualTo(expression);
        }
Beispiel #3
0
        public void when_an_operation_divide_is_sent_after_two_numbers_it_should_display_the_division_of_those_numbers(
            [Random(10)] int digit1,
            [Random(10)] int digit2)
        {
            string operation  = "/";
            string expression = $"{digit1} {digit2} {operation}";

            var result = RPNCalculator.Resolve(expression, (s => s == operation, RPNCalculator.Divide));

            Check.That(result).IsEqualTo((digit1 / digit2).ToString());
        }