public void InitClojureFnMappingsWorks() { //SanityCheck.PrintMethods(_obj.GetType()); Impl1 impl1 = _obj as Impl1; Expect(impl1.m1(21), EqualTo(100)); MethodInfo m1Method = _proxyType.GetMethod("m1", new Type[] { typeof(int) }); Expect(m1Method, Not.Null); Expect(m1Method.Invoke(_obj, new object[] { 21 }), EqualTo(100)); I1 i1 = _obj as I1; Expect(i1, Not.Null); Expect(i1.m1(42), EqualTo(100)); Expect(i1.m2("help"), EqualTo(200)); // just hoping the next one doesn't blow up // We set a flag to test Fn2V._called = false; i1.m2v("abcd"); Expect(Fn2V._called); Expect(i1.m2s("job"), EqualTo("nice job")); I2 i2 = _obj as I2; Expect(i2, Not.Null); Expect(i2.m1(25), EqualTo(100)); Expect(i2.m3(60), EqualTo(300)); Expect(i2.m3("test"), EqualTo(300)); Expect(i2.m4("junk"), EqualTo(400)); }
public void UpdateClojureFnMappingsWorks() { IProxy ip = _obj as IProxy; ip.__updateClojureFnMappings( PersistentHashMap.create("m3", new Fn3(500), "m4", new Fn4(600))); I2 i2 = _obj as I2; Expect(i2, Not.Null); Expect(i2.m1(25), EqualTo(100)); Expect(i2.m3(60), EqualTo(500)); Expect(i2.m3("test"), EqualTo(500)); Expect(i2.m4("junk"), EqualTo(600)); }