|
|
@ -71,7 +71,7 @@ namespace Google.ProtocolBuffers { |
|
|
|
MockRepository mocks = new MockRepository(); |
|
|
|
MockRepository mocks = new MockRepository(); |
|
|
|
FooRequest fooRequest = FooRequest.CreateBuilder().Build(); |
|
|
|
FooRequest fooRequest = FooRequest.CreateBuilder().Build(); |
|
|
|
FooResponse fooResponse = FooResponse.CreateBuilder().Build(); |
|
|
|
FooResponse fooResponse = FooResponse.CreateBuilder().Build(); |
|
|
|
IRpcController controller = mocks.StrictMockWithRemoting<IRpcController>(); |
|
|
|
IRpcController controller = mocks.StrictMock<IRpcController>(); |
|
|
|
|
|
|
|
|
|
|
|
bool fooCalled = false; |
|
|
|
bool fooCalled = false; |
|
|
|
|
|
|
|
|
|
|
@ -107,19 +107,14 @@ namespace Google.ProtocolBuffers { |
|
|
|
/// test. |
|
|
|
/// test. |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
[Test] |
|
|
|
[Test] |
|
|
|
|
|
|
|
[Ignore("Crashes Mono - needs further investigation")] |
|
|
|
public void GeneratedStubFooCall() { |
|
|
|
public void GeneratedStubFooCall() { |
|
|
|
FooRequest fooRequest = FooRequest.CreateBuilder().Build(); |
|
|
|
FooRequest fooRequest = FooRequest.CreateBuilder().Build(); |
|
|
|
MockRepository mocks = new MockRepository(); |
|
|
|
MockRepository mocks = new MockRepository(); |
|
|
|
IRpcChannel mockChannel = mocks.StrictMockWithRemoting<IRpcChannel>(); |
|
|
|
IRpcChannel mockChannel = mocks.StrictMock<IRpcChannel>(); |
|
|
|
IRpcController mockController = mocks.StrictMockWithRemoting<IRpcController>(); |
|
|
|
IRpcController mockController = mocks.StrictMock<IRpcController>(); |
|
|
|
TestService service = TestService.CreateStub(mockChannel); |
|
|
|
TestService service = TestService.CreateStub(mockChannel); |
|
|
|
bool doneCalled = false; |
|
|
|
Action<FooResponse> doneHandler = mocks.StrictMock<Action<FooResponse>>(); |
|
|
|
// TODO(jonskeet): Use Rhino for this (to get ordering) when Mono works with it properly |
|
|
|
|
|
|
|
Action<FooResponse> doneHandler = response => { |
|
|
|
|
|
|
|
Assert.IsFalse(doneCalled); |
|
|
|
|
|
|
|
doneCalled = true; |
|
|
|
|
|
|
|
Assert.AreEqual(FooResponse.DefaultInstance, response); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using (mocks.Record()) { |
|
|
|
using (mocks.Record()) { |
|
|
|
|
|
|
|
|
|
|
@ -129,6 +124,7 @@ namespace Google.ProtocolBuffers { |
|
|
|
.Constraints(Is.Same(FooDescriptor), Is.Same(mockController), Is.Same(fooRequest), |
|
|
|
.Constraints(Is.Same(FooDescriptor), Is.Same(mockController), Is.Same(fooRequest), |
|
|
|
Is.Same(FooResponse.DefaultInstance), Is.Anything()) |
|
|
|
Is.Same(FooResponse.DefaultInstance), Is.Anything()) |
|
|
|
.Do((CallFooDelegate) ((p1, p2, p3, response, done) => done(response))); |
|
|
|
.Do((CallFooDelegate) ((p1, p2, p3, response, done) => done(response))); |
|
|
|
|
|
|
|
doneHandler(FooResponse.DefaultInstance); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
service.Foo(mockController, fooRequest, doneHandler); |
|
|
|
service.Foo(mockController, fooRequest, doneHandler); |
|
|
@ -141,7 +137,7 @@ namespace Google.ProtocolBuffers { |
|
|
|
MockRepository mocks = new MockRepository(); |
|
|
|
MockRepository mocks = new MockRepository(); |
|
|
|
BarRequest barRequest = BarRequest.CreateBuilder().Build(); |
|
|
|
BarRequest barRequest = BarRequest.CreateBuilder().Build(); |
|
|
|
BarResponse barResponse = BarResponse.CreateBuilder().Build(); |
|
|
|
BarResponse barResponse = BarResponse.CreateBuilder().Build(); |
|
|
|
IRpcController controller = mocks.StrictMockWithRemoting<IRpcController>(); |
|
|
|
IRpcController controller = mocks.StrictMock<IRpcController>(); |
|
|
|
|
|
|
|
|
|
|
|
bool barCalled = false; |
|
|
|
bool barCalled = false; |
|
|
|
|
|
|
|
|
|
|
|