Exemple #1
0
        public void Test_IncompleteQuadraticEquation_B_Zero()
        {
            double a = 2;
            double b = 0;
            double c = -32;

            double[] expected = { 4, -4 };

            ResultFullQuadraticEquation actual =
                IncompleteQuadraticEquation.IncompleteQuadraticEquationReqcord(a: a, b: b, c: c);

            Assert.IsTrue(condition: actual.IsDoobleX);
            CollectionAssert.AreEqual
            (
                expected: IncompleteQuadraticEquation.IncompleteQuadraticEquationDoubleArray
                    (a: a, b: b, c: c),
                actual: expected
            );

            a = 2;
            b = 0;
            c = 8;

            actual = IncompleteQuadraticEquation.IncompleteQuadraticEquationReqcord
                         (a: a, b: b, c: c);

            Assert.IsTrue(condition: actual.IsEmpty);
            Assert.IsNull
            (
                anObject: IncompleteQuadraticEquation.IncompleteQuadraticEquationDoubleArray
                    (a: a, b: b, c: c)
            );
        }
Exemple #2
0
        public void Test_FullQuadraticEquation_One_Root()
        {
            //Первое уравнение
            double[] exciptOne = { 1, 12, 36 };
            double[] res1      = { -6 };

            //Получаем запись с решением уравнения
            ResultFullQuadraticEquation actual = FullQuadraticEquation.FullQuadraticEquationReqcord
                                                     (a: exciptOne[0], b: exciptOne[1], c: exciptOne[2]);

            Assert.IsTrue(condition: actual.IsOne);
            CollectionAssert.AreEqual
            (
                expected: FullQuadraticEquation.FullQuadraticEquationDoubleArray
                    (a: exciptOne[0], b: exciptOne[1], c: exciptOne[2]),
                actual: res1
            );

            //Второе уравнение
            exciptOne = new double[] { 1, -6, 9 };
            res1      = new double[] { 3 };

            //Получаем запись с решением уравнения
            actual = FullQuadraticEquation.FullQuadraticEquationReqcord
                         (a: exciptOne[0], b: exciptOne[1], c: exciptOne[2]);

            Assert.IsTrue(condition: actual.IsOne);
            CollectionAssert.AreEqual
            (
                expected: FullQuadraticEquation.FullQuadraticEquationDoubleArray
                    (a: exciptOne[0], b: exciptOne[1], c: exciptOne[2]),
                actual: res1
            );
        }
Exemple #3
0
        public void Test_FullQuadraticEquation_Empty_Root()
        {
            //Первое уравнение
            double[] exciptOne = { 2, 1, 2 };

            //Получаем запись с решением уравнения
            ResultFullQuadraticEquation actual = FullQuadraticEquation.FullQuadraticEquationReqcord
                                                     (a: exciptOne[0], b: exciptOne[1], c: exciptOne[2]);

            Assert.IsTrue(condition: actual.IsEmpty);
            Assert.IsNull
            (
                anObject: FullQuadraticEquation.FullQuadraticEquationDoubleArray
                    (a: exciptOne[0], b: exciptOne[1], c: exciptOne[2])
            );

            //Второе уравнение
            exciptOne = new double[] { 1, -6, 100 };

            //Получаем запись с решением уравнения
            actual = FullQuadraticEquation.FullQuadraticEquationReqcord
                         (a: exciptOne[0], b: exciptOne[1], c: exciptOne[2]);

            Assert.IsTrue(condition: actual.IsEmpty);
            Assert.IsNull
            (
                anObject: FullQuadraticEquation.FullQuadraticEquationDoubleArray
                    (a: exciptOne[0], b: exciptOne[1], c: exciptOne[2])
            );
        }
Exemple #4
0
        public void Test_FullQuadraticEquation_Dooble_Root()
        {
            //Первое уравнение
            double[] exciptOne = { 1, -8, 12 };
            double[] res1      = { 2, 6 };

            //Получаем запись с решением уравнения
            ResultFullQuadraticEquation actual = FullQuadraticEquation.FullQuadraticEquationReqcord
                                                     (a: exciptOne[0], b: exciptOne[1], c: exciptOne[2]);

            Assert.IsTrue(condition: actual.IsDoobleX);
            CollectionAssert.AreEqual
            (
                expected: FullQuadraticEquation.FullQuadraticEquationDoubleArray
                    (a: exciptOne[0], b: exciptOne[1], c: exciptOne[2]),
                actual: res1
            );

            //Второе уравнение
            exciptOne = new double[] { 1, -2, -3 };
            res1      = new double[] { -1, 3 };

            //Получаем запись с решением уравнения
            actual = FullQuadraticEquation.FullQuadraticEquationReqcord
                         (a: exciptOne[0], b: exciptOne[1], c: exciptOne[2]);

            Assert.IsTrue(condition: actual.IsDoobleX);
            CollectionAssert.AreEqual
            (
                expected: FullQuadraticEquation.FullQuadraticEquationDoubleArray
                    (a: exciptOne[0], b: exciptOne[1], c: exciptOne[2]),
                actual: res1
            );

            //Третье уравнение
            exciptOne = new double[] { -1, -2, 15 };
            res1      = new double[] { 3, -5 };

            //Получаем запись с решением уравнения
            actual = FullQuadraticEquation.FullQuadraticEquationReqcord
                         (a: exciptOne[0], b: exciptOne[1], c: exciptOne[2]);

            Assert.IsTrue(condition: actual.IsDoobleX);
            CollectionAssert.AreEqual
            (
                expected: FullQuadraticEquation.FullQuadraticEquationDoubleArray
                    (a: exciptOne[0], b: exciptOne[1], c: exciptOne[2]),
                actual: res1
            );
        }
Exemple #5
0
        public void Test_IncompleteQuadraticEquation_B_C_Zero()
        {
            double a = 7;
            double b = 0;
            double c = 0;

            double[] expected = { 0, 0 };

            ResultFullQuadraticEquation actual =
                IncompleteQuadraticEquation.IncompleteQuadraticEquationReqcord(a: a, b: b, c: c);

            Assert.IsTrue(condition: actual.IsDoobleX);
            CollectionAssert.AreEqual
            (
                expected: IncompleteQuadraticEquation.IncompleteQuadraticEquationDoubleArray
                    (a: a, b: b, c: c),
                actual: expected
            );
        }