Exemplo n.º 1
0
        public void TypeOfSinus_GetDerivative_ResultMustBeTypeOfCosine()
        {
            var variableOfSinus = new SinusFunction();
            var result          = new CosineFunction();

            Assert.AreEqual(result.ToString(), variableOfSinus.GetDerivative().ToString());
        }
Exemplo n.º 2
0
        public void ArgumentZero_Calculate_ResultMustBeZero()
        {
            var variableSinus = new SinusFunction();


            Assert.Zero(variableSinus.Calculate(0));
        }
Exemplo n.º 3
0
        public ICommand BuildCommand(string input)
        {
            var regexForName = new Regex(@"\w+$");
            var name         = regexForName.Match(input).ToString();
            var sin          = new SinusFunction();

            return(new AddFunctionCommand(name, sin));
        }
Exemplo n.º 4
0
        public void FractionalArgument_Calculate_ResultMustBeNumber()
        {
            var variableSinus = new SinusFunction();
            var result        = variableSinus.Calculate(999.09);
            var validResult   = 0.063;


            Assert.IsTrue(result.Eq(validResult));
        }
Exemplo n.º 5
0
        public void ArgumentOfMinus_Calculate_ResultMustBeNumber()
        {
            var variableSinus = new SinusFunction();
            var result        = variableSinus.Calculate(-2);
            var validResult   = -0.909;


            Assert.IsTrue(result.Eq(validResult));
        }
Exemplo n.º 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);
        }