IronRuby.Tests.Tests.RubyHosting_Scopes3 C# (CSharp) Method

RubyHosting_Scopes3() public method

public RubyHosting_Scopes3 ( ) : void
return void
        public void RubyHosting_Scopes3() {
            // TODO: test other backing storages (not implemented yet):

            var variables = new Dictionary<string, object>();
            variables["x"] = 1;
            variables["y"] = 3;

            var scope = Engine.CreateScope(variables);

            string script = @"
def foo
  x + y
end
";
            Engine.Execute(script, scope);

            Assert(scope.GetVariable<int>("x") == 1);
            Assert(scope.GetVariable<int>("y") == 3);

            var foo = scope.GetVariable<Func<int>>("foo");
            Assert(foo() == 4);
        }
Tests