コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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());
        }