public void CallMethodFoo() { FooRequest fooRequest = FooRequest.CreateBuilder().Build(); FooResponse fooResponse = FooResponse.CreateBuilder().Build(); IRpcController controller = new RpcTestController(); bool fooCalled = false; TestGenericService service = new TestServiceImpl((request, responseAction) => { Assert.AreSame(fooRequest, request); fooCalled = true; responseAction(fooResponse); }, null, controller); bool doneHandlerCalled = false; Action<IMessage> doneHandler = (response => { Assert.AreSame(fooResponse, response); doneHandlerCalled = true; }); service.CallMethod(FooDescriptor, controller, fooRequest, doneHandler); Assert.IsTrue(doneHandlerCalled); Assert.IsTrue(fooCalled); }
public void CallMethodFoo() { FooRequest fooRequest = FooRequest.CreateBuilder().Build(); FooResponse fooResponse = FooResponse.CreateBuilder().Build(); IRpcController controller = new RpcTestController(); bool fooCalled = false; TestGenericService service = new TestServiceImpl((request, responseAction) => { Assert.AreSame(fooRequest, request); fooCalled = true; responseAction(fooResponse); }, null, controller); bool doneHandlerCalled = false; Action <IMessage> doneHandler = (response => { Assert.AreSame(fooResponse, response); doneHandlerCalled = true; }); service.CallMethod(FooDescriptor, controller, fooRequest, doneHandler); Assert.IsTrue(doneHandlerCalled); Assert.IsTrue(fooCalled); }
public void CallMethodBar() { BarRequest barRequest = BarRequest.CreateBuilder().Build(); BarResponse barResponse = BarResponse.CreateBuilder().Build(); IRpcController controller = new RpcTestController(); bool barCalled = false; TestGenericService service = new TestServiceImpl(null, (request, responseAction) => { Assert.AreSame(barRequest, request); barCalled = true; responseAction(barResponse); }, controller); bool doneHandlerCalled = false; Action <IMessage> doneHandler = (response => { Assert.AreSame(barResponse, response); doneHandlerCalled = true; }); service.CallMethod(BarDescriptor, controller, barRequest, doneHandler); Assert.IsTrue(doneHandlerCalled); Assert.IsTrue(barCalled); }
public void GeneratedStubBarCallFails() { IRpcChannel channel = new RpcTestChannel(); IRpcController controller = new RpcTestController(); TestGenericService service = TestGenericService.CreateStub(channel); BarResponse barResponse = null; Action <BarResponse> doneHandler = r => barResponse = r; service.Bar(controller, BarRequest.DefaultInstance, doneHandler); Assert.IsNull(barResponse); Assert.IsTrue(controller.Failed); }
public void GeneratedStubFooCall() { IRpcChannel channel = new RpcTestChannel(); IRpcController controller = new RpcTestController(); TestGenericService service = TestGenericService.CreateStub(channel); FooResponse fooResponse = null; Action <FooResponse> doneHandler = r => fooResponse = r; service.Foo(controller, FooRequest.DefaultInstance, doneHandler); Assert.IsNotNull(fooResponse); Assert.IsFalse(controller.Failed); }
public void GeneratedStubBarCallFails() { IRpcChannel channel = new RpcTestChannel(); IRpcController controller = new RpcTestController(); TestGenericService service = TestGenericService.CreateStub(channel); BarResponse barResponse = null; Action<BarResponse> doneHandler = r => barResponse = r; service.Bar(controller, BarRequest.DefaultInstance, doneHandler); Assert.IsNull(barResponse); Assert.IsTrue(controller.Failed); }
public void GeneratedStubFooCall() { IRpcChannel channel = new RpcTestChannel(); IRpcController controller = new RpcTestController(); TestGenericService service = TestGenericService.CreateStub(channel); FooResponse fooResponse = null; Action<FooResponse> doneHandler = r => fooResponse = r; service.Foo(controller, FooRequest.DefaultInstance, doneHandler); Assert.IsNotNull(fooResponse); Assert.IsFalse(controller.Failed); }
public void CallMethodBar() { BarRequest barRequest = BarRequest.CreateBuilder().Build(); BarResponse barResponse = BarResponse.CreateBuilder().Build(); IRpcController controller = new RpcTestController(); bool barCalled = false; TestGenericService service = new TestServiceImpl(null, (request, responseAction) => { Assert.AreSame(barRequest, request); barCalled = true; responseAction(barResponse); }, controller); bool doneHandlerCalled = false; Action<IMessage> doneHandler = (response => { Assert.AreSame(barResponse, response); doneHandlerCalled = true; }); service.CallMethod(BarDescriptor, controller, barRequest, doneHandler); Assert.IsTrue(doneHandlerCalled); Assert.IsTrue(barCalled); }