public async stt::Task RawPredictAsync() { moq::Mock <PredictionService.PredictionServiceClient> mockGrpcClient = new moq::Mock <PredictionService.PredictionServiceClient>(moq::MockBehavior.Strict); RawPredictRequest request = new RawPredictRequest { EndpointAsEndpointName = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"), HttpBody = new ga::HttpBody(), }; ga::HttpBody expectedResponse = new ga::HttpBody { ContentType = "content_type085be0ea", Data = proto::ByteString.CopyFromUtf8("data387f778d"), Extensions = { new wkt::Any(), }, }; mockGrpcClient.Setup(x => x.RawPredictAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ga::HttpBody>(stt::Task.FromResult(expectedResponse), null, null, null, null)); PredictionServiceClient client = new PredictionServiceClientImpl(mockGrpcClient.Object, null); ga::HttpBody responseCallSettings = await client.RawPredictAsync(request.Endpoint, request.HttpBody, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); ga::HttpBody responseCancellationToken = await client.RawPredictAsync(request.Endpoint, request.HttpBody, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async stt::Task CollectUserEventResourceNamesAsync() { moq::Mock <UserEventService.UserEventServiceClient> mockGrpcClient = new moq::Mock <UserEventService.UserEventServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); CollectUserEventRequest request = new CollectUserEventRequest { ParentAsEventStoreName = EventStoreName.FromProjectLocationCatalogEventStore("[PROJECT]", "[LOCATION]", "[CATALOG]", "[EVENT_STORE]"), UserEvent = "user_eventc8146d99", Uri = "uri3db70593", Ets = -4649673071663131288L, }; ga::HttpBody expectedResponse = new ga::HttpBody { ContentType = "content_type085be0ea", Data = proto::ByteString.CopyFromUtf8("data387f778d"), Extensions = { new wkt::Any(), }, }; mockGrpcClient.Setup(x => x.CollectUserEventAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ga::HttpBody>(stt::Task.FromResult(expectedResponse), null, null, null, null)); UserEventServiceClient client = new UserEventServiceClientImpl(mockGrpcClient.Object, null); ga::HttpBody responseCallSettings = await client.CollectUserEventAsync(request.ParentAsEventStoreName, request.UserEvent, request.Uri, request.Ets, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); ga::HttpBody responseCancellationToken = await client.CollectUserEventAsync(request.ParentAsEventStoreName, request.UserEvent, request.Uri, request.Ets, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void CollectUserEventRequestObject() { moq::Mock <UserEventService.UserEventServiceClient> mockGrpcClient = new moq::Mock <UserEventService.UserEventServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); CollectUserEventRequest request = new CollectUserEventRequest { ParentAsEventStoreName = EventStoreName.FromProjectLocationCatalogEventStore("[PROJECT]", "[LOCATION]", "[CATALOG]", "[EVENT_STORE]"), UserEvent = "user_eventc8146d99", Uri = "uri3db70593", Ets = -4649673071663131288L, }; ga::HttpBody expectedResponse = new ga::HttpBody { ContentType = "content_type085be0ea", Data = proto::ByteString.CopyFromUtf8("data387f778d"), Extensions = { new wkt::Any(), }, }; mockGrpcClient.Setup(x => x.CollectUserEvent(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); UserEventServiceClient client = new UserEventServiceClientImpl(mockGrpcClient.Object, null); ga::HttpBody response = client.CollectUserEvent(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void RawPredictResourceNames() { moq::Mock <PredictionService.PredictionServiceClient> mockGrpcClient = new moq::Mock <PredictionService.PredictionServiceClient>(moq::MockBehavior.Strict); RawPredictRequest request = new RawPredictRequest { EndpointAsEndpointName = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"), HttpBody = new ga::HttpBody(), }; ga::HttpBody expectedResponse = new ga::HttpBody { ContentType = "content_type085be0ea", Data = proto::ByteString.CopyFromUtf8("data387f778d"), Extensions = { new wkt::Any(), }, }; mockGrpcClient.Setup(x => x.RawPredict(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); PredictionServiceClient client = new PredictionServiceClientImpl(mockGrpcClient.Object, null); ga::HttpBody response = client.RawPredict(request.EndpointAsEndpointName, request.HttpBody); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void PostResourceRequestObject() { moq::Mock <GatewayService.GatewayServiceClient> mockGrpcClient = new moq::Mock <GatewayService.GatewayServiceClient>(moq::MockBehavior.Strict); ga::HttpBody request = new ga::HttpBody { ContentType = "content_type085be0ea", Data = proto::ByteString.CopyFromUtf8("data387f778d"), Extensions = { new wkt::Any(), }, }; ga::HttpBody expectedResponse = new ga::HttpBody { ContentType = "content_type085be0ea", Data = proto::ByteString.CopyFromUtf8("data387f778d"), Extensions = { new wkt::Any(), }, }; mockGrpcClient.Setup(x => x.PostResource(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); GatewayServiceClient client = new GatewayServiceClientImpl(mockGrpcClient.Object, null); ga::HttpBody response = client.PostResource(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary> /// PatchResource performs an HTTP PATCH on the Kubernetes API Server. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public override stt::Task <ga::HttpBody> PatchResourceAsync(ga::HttpBody request, gaxgrpc::CallSettings callSettings = null) { Modify_HttpBody(ref request, ref callSettings); return(_callPatchResource.Async(request, callSettings)); }
/// <summary> /// PatchResource performs an HTTP PATCH on the Kubernetes API Server. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public override ga::HttpBody PatchResource(ga::HttpBody request, gaxgrpc::CallSettings callSettings = null) { Modify_HttpBody(ref request, ref callSettings); return(_callPatchResource.Sync(request, callSettings)); }
partial void Modify_HttpBody(ref ga::HttpBody request, ref gaxgrpc::CallSettings settings);
/// <summary> /// PatchResource performs an HTTP PATCH on the Kubernetes API Server. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <ga::HttpBody> PatchResourceAsync(ga::HttpBody request, st::CancellationToken cancellationToken) => PatchResourceAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// PatchResource performs an HTTP PATCH on the Kubernetes API Server. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <ga::HttpBody> PatchResourceAsync(ga::HttpBody request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();
/// <summary> /// PutResource performs an HTTP PUT on the Kubernetes API Server. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public virtual ga::HttpBody PutResource(ga::HttpBody request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();