public async stt::Task ListPlannableLocationsRequestObjectAsync() { moq::Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new moq::Mock <ReachPlanService.ReachPlanServiceClient>(moq::MockBehavior.Strict); ListPlannableLocationsRequest request = new ListPlannableLocationsRequest { }; ListPlannableLocationsResponse expectedResponse = new ListPlannableLocationsResponse { PlannableLocations = { new PlannableLocation(), }, }; mockGrpcClient.Setup(x => x.ListPlannableLocationsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ListPlannableLocationsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); ReachPlanServiceClient client = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null); ListPlannableLocationsResponse responseCallSettings = await client.ListPlannableLocationsAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); ListPlannableLocationsResponse responseCancellationToken = await client.ListPlannableLocationsAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async Task ListPlannableLocationsAsync() { Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new Mock <ReachPlanService.ReachPlanServiceClient>(MockBehavior.Strict); ListPlannableLocationsRequest request = new ListPlannableLocationsRequest(); ListPlannableLocationsResponse expectedResponse = new ListPlannableLocationsResponse(); mockGrpcClient.Setup(x => x.ListPlannableLocationsAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <ListPlannableLocationsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); ReachPlanServiceClient client = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null); ListPlannableLocationsResponse response = await client.ListPlannableLocationsAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }