Beispiel #1
0
        public void ExecuteNullDerivTest()
        {
            var exp = new Derivative(Variable.X)
            {
                Differentiator = null,
                Simplifier     = null
            };

            Assert.Throws <ArgumentNullException>(() => exp.Execute());
        }
Beispiel #2
0
        public void ExecutePointTest()
        {
            var differentiator = new Mock <IDifferentiator>();

            differentiator.Setup(d => d.Analyze(It.IsAny <Derivative>()))
            .Returns <Derivative>(exp => exp.Expression);

            var deriv = new Derivative(differentiator.Object, null, Variable.X, Variable.X, new Number(2));

            Assert.Equal(2.0, deriv.Execute());
        }
Beispiel #3
0
        public void ExecuteNullSimpTest()
        {
            var differentiator = new Mock <IDifferentiator>();

            differentiator.Setup(d => d.Analyze(It.IsAny <Derivative>()))
            .Returns <Derivative>(e => e.Expression);

            var exp = new Derivative(differentiator.Object, null, Variable.X);

            var result = exp.Execute();

            Assert.Equal(result, result);
        }
Beispiel #4
0
        public void ExecuteNullDerivTest()
        {
            var exp = new Derivative(null, null, Variable.X);

            Assert.Throws <ArgumentNullException>(() => exp.Execute());
        }