public async stt::Task CreateAutoscalingPolicyRequestObjectAsync()
        {
            moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(moq::MockBehavior.Strict);
            CreateAutoscalingPolicyRequest request = new CreateAutoscalingPolicyRequest
            {
                ParentAsLocationName = gagr::LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                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.CreateAutoscalingPolicyAsync(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.CreateAutoscalingPolicyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            AutoscalingPolicy responseCancellationToken = await client.CreateAutoscalingPolicyAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void GetAutoscalingPolicyResourceNames()
        {
            moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(moq::MockBehavior.Strict);
            GetAutoscalingPolicyRequest request = new GetAutoscalingPolicyRequest
            {
                AutoscalingPolicyName = AutoscalingPolicyName.FromProjectLocationAutoscalingPolicy("[PROJECT]", "[LOCATION]", "[AUTOSCALING_POLICY]"),
            };
            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.GetAutoscalingPolicy(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AutoscalingPolicyServiceClient client = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null);
            AutoscalingPolicy response            = client.GetAutoscalingPolicy(request.AutoscalingPolicyName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #3
0
 /// <summary>Snippet for GetAutoscalingPolicy</summary>
 public void GetAutoscalingPolicyResourceNames()
 {
     // Snippet: GetAutoscalingPolicy(AutoscalingPolicyName, CallSettings)
     // Create client
     AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create();
     // Initialize request argument(s)
     AutoscalingPolicyName name = AutoscalingPolicyName.FromProjectLocationAutoscalingPolicy("[PROJECT]", "[LOCATION]", "[AUTOSCALING_POLICY]");
     // Make the request
     AutoscalingPolicy response = autoscalingPolicyServiceClient.GetAutoscalingPolicy(name);
     // End snippet
 }
 /// <summary>Snippet for GetAutoscalingPolicy</summary>
 public void GetAutoscalingPolicy()
 {
     // Snippet: GetAutoscalingPolicy(string,CallSettings)
     // Create client
     AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create();
     // Initialize request argument(s)
     string formattedName = new AutoscalingPolicyName("[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]").ToString();
     // Make the request
     AutoscalingPolicy response = autoscalingPolicyServiceClient.GetAutoscalingPolicy(formattedName);
     // End snippet
 }
コード例 #5
0
        /// <summary>Snippet for DeleteAutoscalingPolicyAsync</summary>
        public async Task DeleteAutoscalingPolicyResourceNamesAsync()
        {
            // Snippet: DeleteAutoscalingPolicyAsync(AutoscalingPolicyName, CallSettings)
            // Additional: DeleteAutoscalingPolicyAsync(AutoscalingPolicyName, CancellationToken)
            // Create client
            AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync();

            // Initialize request argument(s)
            AutoscalingPolicyName name = AutoscalingPolicyName.FromProjectLocationAutoscalingPolicy("[PROJECT]", "[LOCATION]", "[AUTOSCALING_POLICY]");
            // Make the request
            await autoscalingPolicyServiceClient.DeleteAutoscalingPolicyAsync(name);

            // End snippet
        }
コード例 #6
0
 /// <summary>Snippet for GetAutoscalingPolicy</summary>
 public void GetAutoscalingPolicyRequestObject()
 {
     // Snippet: GetAutoscalingPolicy(GetAutoscalingPolicyRequest, CallSettings)
     // Create client
     AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create();
     // Initialize request argument(s)
     GetAutoscalingPolicyRequest request = new GetAutoscalingPolicyRequest
     {
         AutoscalingPolicyName = AutoscalingPolicyName.FromProjectLocationAutoscalingPolicy("[PROJECT]", "[LOCATION]", "[AUTOSCALING_POLICY]"),
     };
     // Make the request
     AutoscalingPolicy response = autoscalingPolicyServiceClient.GetAutoscalingPolicy(request);
     // End snippet
 }
        /// <summary>Snippet for DeleteAutoscalingPolicyAsync</summary>
        public async Task DeleteAutoscalingPolicyAsync()
        {
            // Snippet: DeleteAutoscalingPolicyAsync(string,CallSettings)
            // Additional: DeleteAutoscalingPolicyAsync(string,CancellationToken)
            // Create client
            AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync();

            // Initialize request argument(s)
            string formattedName = new AutoscalingPolicyName("[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]").ToString();
            // Make the request
            await autoscalingPolicyServiceClient.DeleteAutoscalingPolicyAsync(formattedName);

            // End snippet
        }
        public void DeleteAutoscalingPolicyResourceNames()
        {
            moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(moq::MockBehavior.Strict);
            DeleteAutoscalingPolicyRequest request = new DeleteAutoscalingPolicyRequest
            {
                AutoscalingPolicyName = AutoscalingPolicyName.FromProjectLocationAutoscalingPolicy("[PROJECT]", "[LOCATION]", "[AUTOSCALING_POLICY]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeleteAutoscalingPolicy(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AutoscalingPolicyServiceClient client = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null);

            client.DeleteAutoscalingPolicy(request.AutoscalingPolicyName);
            mockGrpcClient.VerifyAll();
        }
コード例 #9
0
        /// <summary>Snippet for GetAutoscalingPolicyAsync</summary>
        public async Task GetAutoscalingPolicyRequestObjectAsync()
        {
            // Snippet: GetAutoscalingPolicyAsync(GetAutoscalingPolicyRequest, CallSettings)
            // Additional: GetAutoscalingPolicyAsync(GetAutoscalingPolicyRequest, CancellationToken)
            // Create client
            AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetAutoscalingPolicyRequest request = new GetAutoscalingPolicyRequest
            {
                AutoscalingPolicyName = AutoscalingPolicyName.FromProjectLocationAutoscalingPolicy("[PROJECT]", "[LOCATION]", "[AUTOSCALING_POLICY]"),
            };
            // Make the request
            AutoscalingPolicy response = await autoscalingPolicyServiceClient.GetAutoscalingPolicyAsync(request);

            // End snippet
        }
コード例 #10
0
        public async Task DeleteAutoscalingPolicyAsync()
        {
            Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(MockBehavior.Strict);
            DeleteAutoscalingPolicyRequest expectedRequest = new DeleteAutoscalingPolicyRequest
            {
                Name = new AutoscalingPolicyName("[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]").ToString(),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteAutoscalingPolicyAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null));
            AutoscalingPolicyServiceClient client = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null);
            string formattedName = new AutoscalingPolicyName("[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]").ToString();
            await client.DeleteAutoscalingPolicyAsync(formattedName);

            mockGrpcClient.VerifyAll();
        }
コード例 #11
0
        public void DeleteAutoscalingPolicy()
        {
            Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(MockBehavior.Strict);
            DeleteAutoscalingPolicyRequest expectedRequest = new DeleteAutoscalingPolicyRequest
            {
                Name = new AutoscalingPolicyName("[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]").ToString(),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteAutoscalingPolicy(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            AutoscalingPolicyServiceClient client = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null);
            string formattedName = new AutoscalingPolicyName("[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]").ToString();

            client.DeleteAutoscalingPolicy(formattedName);
            mockGrpcClient.VerifyAll();
        }
        public async stt::Task DeleteAutoscalingPolicyResourceNamesAsync()
        {
            moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(moq::MockBehavior.Strict);
            DeleteAutoscalingPolicyRequest request = new DeleteAutoscalingPolicyRequest
            {
                AutoscalingPolicyName = AutoscalingPolicyName.FromProjectLocationAutoscalingPolicy("[PROJECT]", "[LOCATION]", "[AUTOSCALING_POLICY]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeleteAutoscalingPolicyAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            AutoscalingPolicyServiceClient client = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null);
            await client.DeleteAutoscalingPolicyAsync(request.AutoscalingPolicyName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            await client.DeleteAutoscalingPolicyAsync(request.AutoscalingPolicyName, st::CancellationToken.None);

            mockGrpcClient.VerifyAll();
        }
コード例 #13
0
        public async Task GetAutoscalingPolicyAsync()
        {
            Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(MockBehavior.Strict);
            GetAutoscalingPolicyRequest expectedRequest = new GetAutoscalingPolicyRequest
            {
                Name = new AutoscalingPolicyName("[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]").ToString(),
            };
            AutoscalingPolicy expectedResponse = new AutoscalingPolicy
            {
                Id   = "id3355",
                Name = "name2-1052831874",
            };

            mockGrpcClient.Setup(x => x.GetAutoscalingPolicyAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <AutoscalingPolicy>(Task.FromResult(expectedResponse), null, null, null, null));
            AutoscalingPolicyServiceClient client = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null);
            string            formattedName       = new AutoscalingPolicyName("[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]").ToString();
            AutoscalingPolicy response            = await client.GetAutoscalingPolicyAsync(formattedName);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #14
0
        public void CreateAutoscalingPolicyRequestObject()
        {
            moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(moq::MockBehavior.Strict);
            CreateAutoscalingPolicyRequest request = new CreateAutoscalingPolicyRequest
            {
                ParentAsLocationName = gagr::LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                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(),
            };

            mockGrpcClient.Setup(x => x.CreateAutoscalingPolicy(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AutoscalingPolicyServiceClient client = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null);
            AutoscalingPolicy response            = client.CreateAutoscalingPolicy(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }