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

CrossRuntime2() public method

public CrossRuntime2 ( ) : void
return void
        public void CrossRuntime2() {
            Engine.Execute(@"
C = IronRuby.create_engine.execute <<end
  class C
    def bar
    end
  end
  C
end
");
            // can't define a method on a foreign class:
            AssertExceptionThrown<InvalidOperationException>(() => Engine.Execute("C.send(:define_method, :foo) {}"));

            // can't open a scope of a foreign class:
            AssertExceptionThrown<InvalidOperationException>(() => Engine.Execute("class C; end"));

            // alias operates in the runtime of the class within which scope it is used:
            Engine.Execute("C.send(:alias_method, :foo, :bar); C.new.foo");
        }
        
Tests