Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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());
        }