public void Prig_should_assert_on_method_callbacks() { using (new IndirectionsContext()) { // Arrange var handler = default(Foo.EchoEventHandler); var fooProxy = new PProxyFoo(); fooProxy.AddOnEchoCallbackFooEchoEventHandler().Body = (@this, value) => handler += value; fooProxy.EchoInt32().Body = (@this, arg1) => { handler(true); return(arg1); }; var foo = (Foo)fooProxy; var called = false; foo.OnEchoCallback += echoed => called = echoed; // Act foo.Echo(10); // Assert Assert.IsTrue(called); } }
public void Prig_should_setup_a_call_to_a_final_method() { using (new IndirectionsContext()) { // Arrange var fooProxy = new PProxyFoo(); fooProxy.EchoInt32().Body = (@this, arg1) => 10; var foo = (Foo)fooProxy; // Act var actual = foo.Echo(1); // Assert Assert.AreEqual(10, actual); } }
public void Prig_should_assert_on_method_callbacks() { using (new IndirectionsContext()) { // Arrange var handler = default(Foo.EchoEventHandler); var fooProxy = new PProxyFoo(); fooProxy.AddOnEchoCallbackFooEchoEventHandler().Body = (@this, value) => handler += value; fooProxy.EchoInt32().Body = (@this, arg1) => { handler(true); return arg1; }; var foo = (Foo)fooProxy; var called = false; foo.OnEchoCallback += echoed => called = echoed; // Act foo.Echo(10); // Assert Assert.IsTrue(called); } }