aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/examples/Sample
diff options
context:
space:
mode:
authorGravatar Jorge Canizales <jcanizales@google.com>2015-05-16 12:18:50 -0700
committerGravatar Jorge Canizales <jcanizales@google.com>2015-05-17 16:21:42 -0700
commitc54a0caa0d59ee45e2f7b7e5abd4d08b2b0fad83 (patch)
tree440049bf886fbede96241cbb667763c58f0f7e5c /src/objective-c/examples/Sample
parent184e02bed030378af9451868d57b22a2e2a85470 (diff)
Adds local sample test using generated service
Diffstat (limited to 'src/objective-c/examples/Sample')
-rw-r--r--src/objective-c/examples/Sample/SampleTests/SampleTests.m19
1 files changed, 19 insertions, 0 deletions
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