From c54a0caa0d59ee45e2f7b7e5abd4d08b2b0fad83 Mon Sep 17 00:00:00 2001 From: Jorge Canizales <jcanizales@google.com> Date: Sat, 16 May 2015 12:18:50 -0700 Subject: [PATCH] Adds local sample test using generated service --- .../examples/Sample/SampleTests/SampleTests.m | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/objective-c/examples/Sample/SampleTests/SampleTests.m b/src/objective-c/examples/Sample/SampleTests/SampleTests.m index ebe09627ed..b1a0f78a01 100644 --- a/src/objective-c/examples/Sample/SampleTests/SampleTests.m +++ b/src/objective-c/examples/Sample/SampleTests/SampleTests.m @@ -39,6 +39,7 @@ #import <gRPC/GRXWriter+Immediate.h> #import <gRPC/GRXWriteable.h> #import <Route_guide/RouteGuide.pbobjc.h> +#import <Route_guide/RouteGuide.pbrpc.h> @interface SampleTests : XCTestCase @end @@ -135,4 +136,22 @@ [self waitForExpectationsWithTimeout:2.0 handler:nil]; } + +- (void)testSimpleProtoRPCUsingGeneratedService { + __weak XCTestExpectation *completion = [self expectationWithDescription:@"RPC completed."]; + + RGDPoint *point = [RGDPoint message]; + point.latitude = 28E7; + point.longitude = -15E7; + + RGDRouteGuide *service = [[RGDRouteGuide alloc] initWithHost:@"http://127.0.0.1:8980"]; + [service getFeatureWithRequest:point handler:^(RGDFeature *response, NSError *error) { + XCTAssertNil(error, @"Finished with unexpected error: %@", error); + XCTAssertEqualObjects(point, response.location); + XCTAssertNotNil(response.name, @"Response's name is nil."); + [completion fulfill]; + }]; + + [self waitForExpectationsWithTimeout:2.0 handler:nil]; +} @end -- GitLab