예제 #1
0
        public void TestFifthGreede()
        {
            var testLineFunc = new ComponentFunctionVM()
            {
                ACoefficient = 5, BCoefficient = 6, CCoefficient = 30000, X = "10", Y = "11", NameFunction = "5-ой степени"
            };

            var resalt = CalculateResult.Result(testLineFunc);

            Assert.AreEqual(617846, resalt);
        }
예제 #2
0
        public void TestSecondGreede()
        {
            var testLineFunc = new ComponentFunctionVM()
            {
                ACoefficient = 5, BCoefficient = 6, CCoefficient = 30, X = "10", Y = "11", NameFunction = "квадратичная"
            };

            var resalt = CalculateResult.Result(testLineFunc);

            Assert.AreEqual(596, resalt);
        }
예제 #3
0
        public void TestThirdGreede()
        {
            var testLineFunc = new ComponentFunctionVM()
            {
                ACoefficient = 5, BCoefficient = 6, CCoefficient = 300, X = "10", Y = "11", NameFunction = "кубическая"
            };

            var resalt = CalculateResult.Result(testLineFunc);

            Assert.AreEqual(6026, resalt);
        }
예제 #4
0
        public void TestLineFunc()
        {
            var testLineFunc = new ComponentFunctionVM()
            {
                ACoefficient = 5, BCoefficient = 6, CCoefficient = 3, X = "10", Y = "11", NameFunction = "линейная"
            };

            var resalt = CalculateResult.Result(testLineFunc);

            Assert.AreEqual(59, resalt);
        }
예제 #5
0
        /// <summary>
        /// метод расчета значения Resalt для экземпляров класса ComponentFunctionVM
        /// </summary>
        /// <returns>
        /// значение типа duble расчитанное в соответствии с параметрами function
        /// </returns>
        /// <param name="function">Экземпляр класса ComponentFunctionVM</param>
        public static double Result(ComponentFunctionVM function)
        {
            if (!string.IsNullOrEmpty(function.NameFunction))
            {
                return(function.ACoefficient * Math.Pow(double.Parse(function.X), ListPossibleFunctions.ListFunctions[function.NameFunction] + 1) + function.BCoefficient * Math.Pow(double.Parse(function.Y), ListPossibleFunctions.ListFunctions[function.NameFunction]) + function.CCoefficient);
            }

            else
            {
                return(0);
            }
        }