Esempio n. 1
0
        public void ComplexQuadraticEquation(double a, double b, double c, string stringForm, double firstReal, double firstImaginary, double secondReal, double secondImaginary)
        {
            var equation = new QuadraticEquation(a, b, c);

            equation.ToString().Should().Be(stringForm);
            var solution = equation.Solution();

            solution.IsRealRoots.Should().BeFalse();
            solution.ComplexRoots.FirstRoot.Should().Be(new Complex(firstReal, firstImaginary));
            solution.ComplexRoots.SecondRoot.Should().Be(new Complex(secondReal, secondImaginary));
            Assert.ThrowsException <ArgumentException>(() => solution.RealRoots);
        }
Esempio n. 2
0
        public void RealQuadraticEquation(double a, double b, double c, string stringForm, double firstRoot, double secondRoot)
        {
            var equation = new QuadraticEquation(a, b, c);

            equation.ToString().Should().Be(stringForm);
            var solution = equation.Solution();

            solution.IsRealRoots.Should().BeTrue();
            solution.RealRoots.FirstRoot.Should().Be(firstRoot);
            solution.RealRoots.SecondRoot.Should().Be(secondRoot);
            Assert.ThrowsException <ArgumentException>(() => solution.ComplexRoots);
        }