Example #1
0
        protected override void Given()
        {
            _variable = new Variable("Grasp", "Test", typeof(int));

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

            _initialState = A.Fake<IRuntimeSnapshot>();

            _initialValue = 1;

            A.CallTo(() => _initialState.GetValue(_variable)).Returns(_initialValue);

            _executable = new GraspExecutable(_schema, A.Fake<ICalculator>());
        }
Example #2
0
 private IEnumerable<VariableBinding> GetBindings(IRuntimeSnapshot initialState)
 {
     return Schema.Variables.Select(variable => new VariableBinding(variable, initialState.GetValue(variable)));
 }
Example #3
0
        /// <summary>
        /// Generates a runtime with variables bound to the values yielded by the specified initial state
        /// </summary>
        /// <param name="initialState">The initial state of the variables in the generated runtime</param>
        /// <returns>A runtime with variables bound to the values yielded by the specified initial state</returns>
        public GraspRuntime GetRuntime(IRuntimeSnapshot initialState)
        {
            Contract.Requires(initialState != null);

            return new GraspRuntime(Schema, Calculator, GetBindings(initialState));
        }