示例#1
0
        public void Function_ContainsFunctions_ResultMustBeIsFalse()
        {
            var storage = new FunctionsStorage();

            storage.AddFunction("linear", new LinearFunction(2.3, 5));
            var result = storage.ContainsFunctions("Linear");

            Assert.IsFalse(result);
        }
示例#2
0
        public void Function_DeleteFunction_ResultMustBeIsTrue()
        {
            var storage = new FunctionsStorage();

            storage.AddFunction("Cos", new CosineFunction());
            storage.DeleteFunction("Cos");
            var result = storage.ContainsFunctions("Cos");

            Assert.IsFalse(result);
        }
示例#3
0
        public void Function_GetFunction_ResultMustBeFunction()
        {
            var cos     = new CosineFunction();
            var storage = new FunctionsStorage();

            storage.AddFunction("Cos", new CosineFunction());
            var result = storage.GetFunction("Cos");

            Assert.AreEqual(cos.ToString(), result.ToString());
        }
示例#4
0
        public void LinearFunction_GetDerivative_ResultMustBeNumber()
        {
            var linearFunction = new LinearFunction(2.1, 5);
            var name           = "LinearFunction";
            var storage        = new FunctionsStorage();


            storage.AddFunction(name, linearFunction);


            Assert.AreEqual(storage.GetDerivativeFunction(name).ToString(), "2,1x");
        }
示例#5
0
        public void PowerFunction_Calculate_ResultMustBeNumber()
        {
            var powerFunction = new PowerFunction(3);
            var name          = "powerFunction";
            var storage       = new FunctionsStorage();


            storage.AddFunction(name, powerFunction);


            Assert.AreEqual(storage.CalculateFunction(name, 2.2), 10.648, 0.0001);
        }
示例#6
0
        public void SinusFunction_Calculate_ResultMustBeNumber()
        {
            var sinusFunction = new SinusFunction();
            var name          = "sinus";
            var storage       = new FunctionsStorage();


            storage.AddFunction(name, sinusFunction);


            Assert.AreEqual(storage.CalculateFunction(name, 2), 0.90929742682, 0.0001);
        }