-
Notifications
You must be signed in to change notification settings - Fork 435
Closed
Labels
kind/enhancementImprovements to existing feature.Improvements to existing feature.
Milestone
Description
Question Checklist
- Updated grpc-swift to the latest version
- I read the Contribution Guidelines
- I read README
- I searched for existing GitHub issues
Question Subject
Mocking the client service
Question Description
Here is the client service from example.
public protocol Routeguide_RouteGuideClientProtocol {
func getFeature(_ request: Routeguide_Point, callOptions: CallOptions?) -> UnaryCall<Routeguide_Point, Routeguide_Feature>
func listFeatures(_ request: Routeguide_Rectangle, callOptions: CallOptions?, handler: @escaping (Routeguide_Feature) -> Void) -> ServerStreamingCall<Routeguide_Rectangle, Routeguide_Feature>
func recordRoute(callOptions: CallOptions?) -> ClientStreamingCall<Routeguide_Point, Routeguide_RouteSummary>
func routeChat(callOptions: CallOptions?, handler: @escaping (Routeguide_RouteNote) -> Void) -> BidirectionalStreamingCall<Routeguide_RouteNote, Routeguide_RouteNote>
}
What I want to do is, create mock object for this service.
class Routeguide_RouteGuideClientMock: Routeguide_RouteGuideClientProtocol {
func getFeature(_ request: Routeguide_Point, callOptions: CallOptions?) -> UnaryCall<Routeguide_Point, Routeguide_Feature> {
// return mock object directely
}
func listFeatures(_ request: Routeguide_Rectangle, callOptions: CallOptions?, handler: @escaping (Routeguide_Feature) -> Void) -> ServerStreamingCall<Routeguide_Rectangle, Routeguide_Feature> {
}
func recordRoute(callOptions: CallOptions?) -> ClientStreamingCall<Routeguide_Point, Routeguide_RouteSummary> {
}
func routeChat(callOptions: CallOptions?, handler: @escaping (Routeguide_RouteNote) -> Void) -> BidirectionalStreamingCall<Routeguide_RouteNote, Routeguide_RouteNote> {
}
}
But there is no public initialiser. Is there any way I can accomplish it. Thanks.
davidpasztor and hikaru-sato-coconala
Metadata
Metadata
Assignees
Labels
kind/enhancementImprovements to existing feature.Improvements to existing feature.