public IActionResult Index(FractionCalculator model) { SetViewBagValues(); if (!ModelState.IsValid) { return(View()); } String selectedValue = model.SelectedOperation; switch (selectedValue) { case "Add": break; case "Subtract": break; case "Multiply": break; case "Divide": break; } return(View(model)); }
public void DevideFractionsThrowDevideByZeroExceptionTest() { var left = new Fraction(1, 2); var right = new Fraction(0, 3); Assert.Throws <DivideByZeroException>(() => FractionCalculator.Devide(left, right)); }
public void DevideFractionsTest(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.Devide(left, right); Assert.Equal(resNum, result.Numerator); Assert.Equal(resDen, result.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_divide_negative_fractions(int dividendNumerator, int dividendDenominator, int divisorNumerator, int divisorDenominator, int expectedNumerator, int expectedDenominator) { Assert.That(FractionCalculator.Divide(new Fraction(dividendNumerator, dividendDenominator), new Fraction(divisorNumerator, divisorDenominator)), Is.EqualTo(new Fraction(expectedNumerator, expectedDenominator))); }
public void Should_divide_fractions_with_different_denominator() { Assert.That(FractionCalculator.Divide(new Fraction(3, 4), new Fraction(2, 5)), Is.EqualTo(new Fraction(15, 8))); }
public void Should_subtract_zero_fractions() { Assert.That(FractionCalculator.Subtract(new Fraction(0, 0), new Fraction(0, 0)), Is.EqualTo(new Fraction(0, 0))); }
public void Should_subtract_fractions_with_different_denominator() { Assert.That(FractionCalculator.Subtract(new Fraction(3, 4), new Fraction(2, 5)), Is.EqualTo(new Fraction(7, 20))); }
public void Should_multiply_negative_fractions(int multiplicandNumerator, int multiplicandDenominator, int multiplierNumerator, int multiplierDenominator, int expectedNumerator, int expectedDenominator) { Assert.That(FractionCalculator.Multiply(new Fraction(multiplicandNumerator, multiplicandDenominator), new Fraction(multiplierNumerator, multiplierDenominator)), Is.EqualTo(new Fraction(expectedNumerator, expectedDenominator))); }
public void Should_return_a_zero_fraction_when_one_factor_is_zero(int multiplicandNumerator, int multiplicandDenominator, int multiplierNumerator, int multiplierDenominator, int expectedNumerator, int expectedDenominator) { Assert.That(FractionCalculator.Multiply(new Fraction(multiplicandNumerator, multiplicandDenominator), new Fraction(multiplierNumerator, multiplierDenominator)), Is.EqualTo(new Fraction(expectedNumerator, expectedDenominator))); }
public void Should_multiply_fractions_with_different_denominator() { Assert.That(FractionCalculator.Multiply(new Fraction(1, 4), new Fraction(2, 5)), Is.EqualTo(new Fraction(1, 10))); }
public void Should_multiply_fractions_with_same_denominator() { Assert.That(FractionCalculator.Multiply(new Fraction(1, 4), new Fraction(2, 4)), Is.EqualTo(new Fraction(1, 8))); }
public void Should_multiply_negative_whole_numbers(int multiplicandNumerator, int multiplierNumerator, int expectedNumerator) { Assert.That(FractionCalculator.Multiply(new Fraction(multiplicandNumerator), new Fraction(multiplierNumerator)), Is.EqualTo(new Fraction(expectedNumerator))); }
public void Should_subtract_negative_whole_numbers(int minuendNumerator, int subtrahendNumerator, int expectedNumerator) { Assert.That(FractionCalculator.Subtract(new Fraction(minuendNumerator), new Fraction(subtrahendNumerator)), Is.EqualTo(new Fraction(expectedNumerator))); }
public void Should_subtract_fractions_with_same_denominator() { Assert.That(FractionCalculator.Subtract(new Fraction(4, 5), new Fraction(1, 5)), Is.EqualTo(new Fraction(3, 5))); }
public void Should_multiply_zero_fractions() { Assert.That(FractionCalculator.Multiply(new Fraction(0, 0), new Fraction(0, 0)), Is.EqualTo(new Fraction(0, 0))); }
public void Should_subtract_negative_fractions(int minuendNumerator, int minuendDenominator, int subtrahendNumerator, int subtrahendDenominator, int expectedNumerator, int expectedDenominator) { Assert.That(FractionCalculator.Subtract(new Fraction(minuendNumerator, minuendDenominator), new Fraction(subtrahendNumerator, subtrahendDenominator)), Is.EqualTo(new Fraction(expectedNumerator, expectedDenominator))); }
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))); }
public void Should_divide_fractions_with_same_denominator() { Assert.That(FractionCalculator.Divide(new Fraction(4, 5), new Fraction(1, 5)), Is.EqualTo(new Fraction(4))); }
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_return_a_zero_fraction_when_one_fraction_is_zero(int dividendNumerator, int dividendDenominator, int divisorNumerator, int divisorDenominator, int expectedNumerator, int expectedDenominator) { Assert.That(FractionCalculator.Divide(new Fraction(dividendNumerator, dividendDenominator), new Fraction(divisorNumerator, divisorDenominator)), Is.EqualTo(new Fraction(expectedNumerator, expectedDenominator))); }
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_divide_zero_fractions() { Assert.That(FractionCalculator.Divide(new Fraction(0, 0), new Fraction(0, 0)), Is.EqualTo(new Fraction(0, 0))); }
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))); }