public async Task Add4To5MultipyBy3_Expect27()
        {
            var op = new Multiply()
            {
                Children = new List <IOperation>()
                {
                    new Add()
                    {
                        Variables = new List <Variable>()
                        {
                            new Variable()
                            {
                                Name = "x", Value = 4
                            },
                            new Variable()
                            {
                                Name = "x", Value = 5
                            }
                        }
                    }
                },
                Variables = new List <Variable>()
                {
                    new Variable("x", 3)
                }
            };
            var subProvider = new DictionarySubstitutionProvider(new Dictionary <string, double>()
            {
                { "__unspecified__", 1 }
            });

            var result = await op.Evaluate(subProvider);

            Assert.Equal(27, result);
        }
Exemple #2
0
        public async Task Evaluate_2V1L_Theory(double one, double two, double expected)
        {
            var op = new Multiply()
            {
                Variables = new List <Variable>()
                {
                    one,
                    two
                }
            };
            var subProvider = new DictionarySubstitutionProvider(new Dictionary <string, double>()
            {
                { "__unspecified__", 1 }
            });

            var result = await op.Evaluate(subProvider);

            Assert.Equal(expected, result);
        }
Exemple #3
0
        public async Task FourTo2_16()
        {
            var op = new Exponent()
            {
                Operation = new Add()
                {
                    Variables = new List <Variable>()
                    {
                        4
                    }
                },
                Power = 2
            };
            var subProvider = new DictionarySubstitutionProvider(new Dictionary <string, double>()
            {
                { "__unspecified__", 1 }
            });

            var result = await op.Evaluate(subProvider);

            Assert.Equal(16, result);
        }