示例#1
0
        protected override void Given()
        {
            _schema = new GraspSchema(Enumerable.Empty<Variable>(), Enumerable.Empty<Calculation>());

            _calculator = A.Fake<ICalculator>();

            _runtime = new GraspRuntime(_schema, _calculator, Enumerable.Empty<VariableBinding>());
        }
示例#2
0
        protected override void Given()
        {
            _variable = new Variable("Grasp", "Test", typeof(int));

            _schema = new GraspSchema(new[] { _variable }, Enumerable.Empty<Calculation>());

            _value = 1;

            _runtime = new GraspRuntime(_schema, A.Fake<ICalculator>(), new[] { new VariableBinding(_variable, _value) });
        }
示例#3
0
        protected override void Given()
        {
            _outputVariable = new Variable("Grasp", "Test", typeof(int));

            _value = 1;

            _function = runtime => _value;

            _calculator = new FunctionCalculator(_outputVariable, _function);

            var schema = new GraspSchema(Enumerable.Empty<Variable>(), Enumerable.Empty<Calculation>());

            _runtime = new GraspRuntime(schema, _calculator, Enumerable.Empty<VariableBinding>());
        }
示例#4
0
        protected override void Given()
        {
            _left = 1;
            _right = 2;

            _outputVariable = new Variable("Grasp", "Output", typeof(int));

            var calculation = new Calculation(_outputVariable, Expression.Add(Expression.Constant(_left), Expression.Constant(_right)));

            var schema = new GraspSchema(Enumerable.Empty<Variable>(), new[] { calculation });

            var executable = schema.Compile();

            _runtime = executable.GetRuntime(A.Fake<IRuntimeSnapshot>());
        }
        protected override void Given()
        {
            _left1 = 1;
            _right1 = 2;

            _left2 = 10;

            _outputVariable1 = new Variable("Grasp", "Output1", typeof(int));
            _outputVariable2 = new Variable("Grasp", "Output2", typeof(int));

            var calculation1 = new Calculation(_outputVariable1, Expression.Add(Expression.Constant(_left1), Expression.Constant(_right1)));
            var calculation2 = new Calculation(_outputVariable2, Expression.Add(Expression.Constant(_left2), Variable.Expression(_outputVariable1)));

            var schema = new GraspSchema(Enumerable.Empty<Variable>(), new[] { calculation1, calculation2 });

            var executable = schema.Compile();

            _runtime = executable.GetRuntime(A.Fake<IRuntimeSnapshot>());
        }
示例#6
0
        protected override void Given()
        {
            _outputVariable1 = new Variable("Grasp", "Test1", typeof(int));
            _outputVariable2 = new Variable("Grasp", "Test2", typeof(int));

            _value1 = 1;
            _value2 = 2;

            _function1 = runtime => _value1;
            _function2 = runtime => _value2;

            _calculator1 = new FunctionCalculator(_outputVariable1, _function1);
            _calculator2 = new FunctionCalculator(_outputVariable2, _function2);

            _compositeCalculator = new CompositeCalculator(_calculator1, _calculator2);

            var schema = new GraspSchema(Enumerable.Empty<Variable>(), Enumerable.Empty<Calculation>());

            _runtime = new GraspRuntime(schema, _compositeCalculator, Enumerable.Empty<VariableBinding>());
        }
        protected override void Given()
        {
            _leftValue = 1;
            _right = 2;

            var left = new Variable("Grasp", "Left", typeof(int));

            _outputVariable = new Variable("Grasp", "Output", typeof(int));

            var calculation = new Calculation(_outputVariable, Expression.Add(Variable.Expression(left), Expression.Constant(_right)));

            var schema = new GraspSchema(new[] { left }, new[] { calculation });

            var executable = schema.Compile();

            var initialState = A.Fake<IRuntimeSnapshot>();

            A.CallTo(() => initialState.GetValue(left)).Returns(_leftValue);

            _runtime = executable.GetRuntime(initialState);
        }
示例#8
0
 protected override void When()
 {
     _runtime = _executable.GetRuntime(_initialState);
 }
示例#9
0
 protected override void When()
 {
     _runtime = new GraspRuntime(_schema, _calculator, Enumerable.Empty<VariableBinding>());
 }