Esempio n. 1
0
        public void Has_to_return_correct_value_for_subtraction_of_two_values(decimal valueX, decimal valueY, decimal expected)
        {
            var calculatorValueX = new CalculatorValue(valueX, nameof(valueX));
            var calculatorValueY = new CalculatorValue(valueY, nameof(valueY));
            var expectedResult   = new CalculatorValue(expected, $"{nameof(valueX)} - {nameof(valueY)}");

            var actualResult = SystemUnderTests.Subtract(calculatorValueX, calculatorValueY);

            Assert.AreEqual(expectedResult.Value, actualResult.Value);
            Assert.AreEqual(expectedResult.Name, actualResult.Name);
        }
Esempio n. 2
0
        public void Has_to_return_correct_value_for_subtraction_of_several_values(IEnumerable <decimal> values
                                                                                  , decimal minuend
                                                                                  , decimal expected
                                                                                  , string name
                                                                                  , string expectedName)
        {
            var minuendValue     = new CalculatorValue(minuend, "value");
            var calculatorValues = values.Select(v => new CalculatorValue(v, name));
            var actualResult     = SystemUnderTests.Subtract(calculatorValues, minuendValue);
            var expectedResult   = new CalculatorValue(expected, expectedName);

            Assert.AreEqual(expectedResult.Value, actualResult.Value);
            Assert.AreEqual(expectedResult.Name, actualResult.Name);
        }