public void AddNegativeFractionsTest(int leftNum, int leftDen, int rightNum, int rightDen, int resNum, int resDen) { var left = new Fraction(leftNum, leftDen); var right = new Fraction(rightNum, rightDen); var result = FractionCalculator.Add(left, right); Assert.Equal(resNum, result.Numerator); Assert.Equal(resDen, result.Denominator); }
public void AddTest( int augendNumerator, int augendDenominator, int addendNumerator, int addendDenominator, int expectedNumerator, int expectedDenominator) { var augend = new Fraction(augendNumerator, augendDenominator); var addend = new Fraction(addendNumerator, addendDenominator); var sum = _calculator.Add(augend, addend); Assert.AreEqual(expectedNumerator, sum.Numerator); Assert.AreEqual(expectedDenominator, sum.Denominator); }
public void Should_add_zero_fractions() { Assert.That(FractionCalculator.Add(new Fraction(0, 0), new Fraction(0, 0)), Is.EqualTo(new Fraction(0, 0))); }
public void Should_add_negative_fractions(int addendNumerator, int addendDenominator, int augendNumerator, int augendDenominator, int expectedNumerator, int expectedDenominator) { Assert.That(FractionCalculator.Add(new Fraction(addendNumerator, addendDenominator), new Fraction(augendNumerator, augendDenominator)), Is.EqualTo(new Fraction(expectedNumerator, expectedDenominator))); }
public void Should_add_negative_whole_numbers(int addendNumerator, int augendNumerator, int expectedNumerator) { Assert.That(FractionCalculator.Add(new Fraction(addendNumerator), new Fraction(augendNumerator)), Is.EqualTo(new Fraction(expectedNumerator))); }
public void Should_add_fractions_when_one_addend_is_zero(int addendNumerator, int addendDenominator, int augendNumerator, int augendDenominator, int expectedNumerator, int expectedDenominator) { Assert.That(FractionCalculator.Add(new Fraction(addendNumerator, addendDenominator), new Fraction(augendNumerator, augendDenominator)), Is.EqualTo(new Fraction(expectedNumerator, expectedDenominator))); }
public void Should_add_fractions_with_different_denominator() { Assert.That(FractionCalculator.Add(new Fraction(1, 4), new Fraction(2, 5)), Is.EqualTo(new Fraction(13, 20))); }
public void Should_add_fractions_with_same_denominator() { Assert.That(FractionCalculator.Add(new Fraction(1, 4), new Fraction(2, 4)), Is.EqualTo(new Fraction(3, 4))); }