Ejemplo n.º 1
0
        public void CalculateQuadraticEquationRoots_ExampleWithDeltaEqualsZero_DelatEqualsZero(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            rc.RootCalculate();
            Assert.AreEqual(rc.Delta, 0);
        }
Ejemplo n.º 2
0
        public void CalculateQuadraticEquationRoots_ExampleWithDeltaLowerThanZero_ExpectedMessageForZeroRoots(double firstValue, double secondValue, double thirdValue, string message)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            rc.RootCalculate();
            Assert.AreEqual(rc.ToString(), message);
        }
Ejemplo n.º 3
0
        public void CalculateQuadraticEquationRoots_NegativeFirstPositiveThirdValue_TwoRootsExpected(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            rc.RootCalculate();
            Assert.AreEqual(rc.Roots.Count, 2);
        }
Ejemplo n.º 4
0
        public void CalculateQuadraticEquationRoots_DeltaEqualsZero_OneRoot(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            rc.RootCalculate();
            Assert.AreEqual(rc.Roots.Count, 1);
        }
Ejemplo n.º 5
0
        public void CalculateQuadraticEquationRoots_NegativeFirstPositiveThirdValue_DeltaAlwaysHigherThanZero(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            rc.RootCalculate();
            Assert.Greater(rc.Delta, 0);
        }
Ejemplo n.º 6
0
        public void CalculateQuadraticEquationRoots_DeltaHigherThanZero_TwoRootsExpected(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            rc.RootCalculate();
            Assert.AreEqual(rc.Roots.Count, 2);
        }
Ejemplo n.º 7
0
        public void CalculateQuadraticEquationRoots_ExampleWithDeltaLowerThanZero_ExpectedZeroRoots(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            rc.RootCalculate();
            Assert.AreEqual(rc.Roots.Count, 0);
        }
Ejemplo n.º 8
0
        public void CalculateQuadraticEquationRoots_ExampleWithDeltaLowerThanZero_ExpectedDeltaLowerthanZero(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            rc.RootCalculate();
            Assert.Less(rc.Delta, 0);
        }
Ejemplo n.º 9
0
        public void CalculateQuadraticEquationRoots_ExampleWithFirstValueZero_ExpectedException(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            Assert.Throws <Exception>(() => rc.RootCalculate());
        }