public async stt::Task UpdateAutoscalingPolicyAsync() { moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(moq::MockBehavior.Strict); UpdateAutoscalingPolicyRequest request = new UpdateAutoscalingPolicyRequest { Policy = new AutoscalingPolicy(), }; AutoscalingPolicy expectedResponse = new AutoscalingPolicy { Id = "id74b70bb8", AutoscalingPolicyName = AutoscalingPolicyName.FromProjectLocationAutoscalingPolicy("[PROJECT]", "[LOCATION]", "[AUTOSCALING_POLICY]"), BasicAlgorithm = new BasicAutoscalingAlgorithm(), WorkerConfig = new InstanceGroupAutoscalingPolicyConfig(), SecondaryWorkerConfig = new InstanceGroupAutoscalingPolicyConfig(), Labels = { { "key8a0b6e3c", "value60c16320" }, }, }; mockGrpcClient.Setup(x => x.UpdateAutoscalingPolicyAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <AutoscalingPolicy>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AutoscalingPolicyServiceClient client = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null); AutoscalingPolicy responseCallSettings = await client.UpdateAutoscalingPolicyAsync(request.Policy, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); AutoscalingPolicy responseCancellationToken = await client.UpdateAutoscalingPolicyAsync(request.Policy, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void UpdateAutoscalingPolicy() { moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(moq::MockBehavior.Strict); UpdateAutoscalingPolicyRequest request = new UpdateAutoscalingPolicyRequest { Policy = new AutoscalingPolicy(), }; AutoscalingPolicy expectedResponse = new AutoscalingPolicy { Id = "id74b70bb8", AutoscalingPolicyName = AutoscalingPolicyName.FromProjectLocationAutoscalingPolicy("[PROJECT]", "[LOCATION]", "[AUTOSCALING_POLICY]"), BasicAlgorithm = new BasicAutoscalingAlgorithm(), WorkerConfig = new InstanceGroupAutoscalingPolicyConfig(), SecondaryWorkerConfig = new InstanceGroupAutoscalingPolicyConfig(), Labels = { { "key8a0b6e3c", "value60c16320" }, }, }; mockGrpcClient.Setup(x => x.UpdateAutoscalingPolicy(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AutoscalingPolicyServiceClient client = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null); AutoscalingPolicy response = client.UpdateAutoscalingPolicy(request.Policy); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for UpdateAutoscalingPolicy</summary> public void UpdateAutoscalingPolicyRequestObject() { // Snippet: UpdateAutoscalingPolicy(UpdateAutoscalingPolicyRequest, CallSettings) // Create client AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create(); // Initialize request argument(s) UpdateAutoscalingPolicyRequest request = new UpdateAutoscalingPolicyRequest { Policy = new AutoscalingPolicy(), }; // Make the request AutoscalingPolicy response = autoscalingPolicyServiceClient.UpdateAutoscalingPolicy(request); // End snippet }
/// <summary>Snippet for UpdateAutoscalingPolicyAsync</summary> public async Task UpdateAutoscalingPolicyRequestObjectAsync() { // Snippet: UpdateAutoscalingPolicyAsync(UpdateAutoscalingPolicyRequest, CallSettings) // Additional: UpdateAutoscalingPolicyAsync(UpdateAutoscalingPolicyRequest, CancellationToken) // Create client AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync(); // Initialize request argument(s) UpdateAutoscalingPolicyRequest request = new UpdateAutoscalingPolicyRequest { Policy = new AutoscalingPolicy(), }; // Make the request AutoscalingPolicy response = await autoscalingPolicyServiceClient.UpdateAutoscalingPolicyAsync(request); // End snippet }
public async Task UpdateAutoscalingPolicyAsync2() { Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(MockBehavior.Strict); UpdateAutoscalingPolicyRequest request = new UpdateAutoscalingPolicyRequest { Policy = new AutoscalingPolicy(), }; AutoscalingPolicy expectedResponse = new AutoscalingPolicy { Id = "id3355", Name = "name3373707", }; mockGrpcClient.Setup(x => x.UpdateAutoscalingPolicyAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <AutoscalingPolicy>(Task.FromResult(expectedResponse), null, null, null, null)); AutoscalingPolicyServiceClient client = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null); AutoscalingPolicy response = await client.UpdateAutoscalingPolicyAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void UpdateAutoscalingPolicy2() { Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(MockBehavior.Strict); UpdateAutoscalingPolicyRequest request = new UpdateAutoscalingPolicyRequest { Policy = new AutoscalingPolicy(), }; AutoscalingPolicy expectedResponse = new AutoscalingPolicy { Id = "id3355", Name = "name3373707", }; mockGrpcClient.Setup(x => x.UpdateAutoscalingPolicy(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); AutoscalingPolicyServiceClient client = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null); AutoscalingPolicy response = client.UpdateAutoscalingPolicy(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary> /// Updates (replaces) autoscaling policy. /// /// Disabled check for update_mask, because all updates will be full /// replacements. /// </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 <AutoscalingPolicy> UpdateAutoscalingPolicyAsync(UpdateAutoscalingPolicyRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_UpdateAutoscalingPolicyRequest(ref request, ref callSettings); return(_callUpdateAutoscalingPolicy.Async(request, callSettings)); }
/// <summary> /// Updates (replaces) autoscaling policy. /// /// Disabled check for update_mask, because all updates will be full /// replacements. /// </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 AutoscalingPolicy UpdateAutoscalingPolicy(UpdateAutoscalingPolicyRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_UpdateAutoscalingPolicyRequest(ref request, ref callSettings); return(_callUpdateAutoscalingPolicy.Sync(request, callSettings)); }
partial void Modify_UpdateAutoscalingPolicyRequest(ref UpdateAutoscalingPolicyRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Updates (replaces) autoscaling policy. /// /// Disabled check for update_mask, because all updates will be full /// replacements. /// </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 <AutoscalingPolicy> UpdateAutoscalingPolicyAsync(UpdateAutoscalingPolicyRequest request, st::CancellationToken cancellationToken) => UpdateAutoscalingPolicyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Updates (replaces) autoscaling policy. /// /// Disabled check for update_mask, because all updates will be full /// replacements. /// </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 <AutoscalingPolicy> UpdateAutoscalingPolicyAsync(UpdateAutoscalingPolicyRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();
/// <summary> /// Updates (replaces) autoscaling policy. /// /// Disabled check for update_mask, because all updates will be full /// replacements. /// </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 AutoscalingPolicy UpdateAutoscalingPolicy(UpdateAutoscalingPolicyRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();