public async stt::Task ListPreconfiguredExpressionSetsRequestObjectAsync()
        {
            moq::Mock <SecurityPolicies.SecurityPoliciesClient> mockGrpcClient = new moq::Mock <SecurityPolicies.SecurityPoliciesClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            ListPreconfiguredExpressionSetsSecurityPoliciesRequest request = new ListPreconfiguredExpressionSetsSecurityPoliciesRequest
            {
                PageToken            = "page_tokenf09e5538",
                MaxResults           = 2806814450U,
                OrderBy              = "order_byb4d33ada",
                Project              = "projectaa6ff846",
                Filter               = "filtere47ac9b2",
                ReturnPartialSuccess = false,
            };
            SecurityPoliciesListPreconfiguredExpressionSetsResponse expectedResponse = new SecurityPoliciesListPreconfiguredExpressionSetsResponse
            {
                PreconfiguredExpressionSets = new SecurityPoliciesWafConfig(),
            };

            mockGrpcClient.Setup(x => x.ListPreconfiguredExpressionSetsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <SecurityPoliciesListPreconfiguredExpressionSetsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            SecurityPoliciesClient client = new SecurityPoliciesClientImpl(mockGrpcClient.Object, null);
            SecurityPoliciesListPreconfiguredExpressionSetsResponse responseCallSettings = await client.ListPreconfiguredExpressionSetsAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void ListPreconfiguredExpressionSetsRequestObject()
        {
            moq::Mock <SecurityPolicies.SecurityPoliciesClient> mockGrpcClient = new moq::Mock <SecurityPolicies.SecurityPoliciesClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            ListPreconfiguredExpressionSetsSecurityPoliciesRequest request = new ListPreconfiguredExpressionSetsSecurityPoliciesRequest
            {
                PageToken            = "page_tokenf09e5538",
                MaxResults           = 2806814450U,
                OrderBy              = "order_byb4d33ada",
                Project              = "projectaa6ff846",
                Filter               = "filtere47ac9b2",
                ReturnPartialSuccess = false,
            };
            SecurityPoliciesListPreconfiguredExpressionSetsResponse expectedResponse = new SecurityPoliciesListPreconfiguredExpressionSetsResponse
            {
                PreconfiguredExpressionSets = new SecurityPoliciesWafConfig(),
            };

            mockGrpcClient.Setup(x => x.ListPreconfiguredExpressionSets(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            SecurityPoliciesClient client = new SecurityPoliciesClientImpl(mockGrpcClient.Object, null);
            SecurityPoliciesListPreconfiguredExpressionSetsResponse response = client.ListPreconfiguredExpressionSets(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #3
0
 /// <summary>Snippet for ListPreconfiguredExpressionSets</summary>
 public void ListPreconfiguredExpressionSetsRequestObject()
 {
     // Snippet: ListPreconfiguredExpressionSets(ListPreconfiguredExpressionSetsSecurityPoliciesRequest, CallSettings)
     // Create client
     SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.Create();
     // Initialize request argument(s)
     ListPreconfiguredExpressionSetsSecurityPoliciesRequest request = new ListPreconfiguredExpressionSetsSecurityPoliciesRequest
     {
         PageToken            = "",
         MaxResults           = 0U,
         Filter               = "",
         OrderBy              = "",
         Project              = "",
         ReturnPartialSuccess = false,
     };
     // Make the request
     SecurityPoliciesListPreconfiguredExpressionSetsResponse response = securityPoliciesClient.ListPreconfiguredExpressionSets(request);
     // End snippet
 }
        public void ListPreconfiguredExpressionSets()
        {
            moq::Mock <SecurityPolicies.SecurityPoliciesClient> mockGrpcClient = new moq::Mock <SecurityPolicies.SecurityPoliciesClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            ListPreconfiguredExpressionSetsSecurityPoliciesRequest request = new ListPreconfiguredExpressionSetsSecurityPoliciesRequest
            {
                Project = "projectaa6ff846",
            };
            SecurityPoliciesListPreconfiguredExpressionSetsResponse expectedResponse = new SecurityPoliciesListPreconfiguredExpressionSetsResponse
            {
                PreconfiguredExpressionSets = new SecurityPoliciesWafConfig(),
            };

            mockGrpcClient.Setup(x => x.ListPreconfiguredExpressionSets(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            SecurityPoliciesClient client = new SecurityPoliciesClientImpl(mockGrpcClient.Object, null);
            SecurityPoliciesListPreconfiguredExpressionSetsResponse response = client.ListPreconfiguredExpressionSets(request.Project);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #5
0
        /// <summary>Snippet for ListPreconfiguredExpressionSetsAsync</summary>
        public async Task ListPreconfiguredExpressionSetsRequestObjectAsync()
        {
            // Snippet: ListPreconfiguredExpressionSetsAsync(ListPreconfiguredExpressionSetsSecurityPoliciesRequest, CallSettings)
            // Additional: ListPreconfiguredExpressionSetsAsync(ListPreconfiguredExpressionSetsSecurityPoliciesRequest, CancellationToken)
            // Create client
            SecurityPoliciesClient securityPoliciesClient = await SecurityPoliciesClient.CreateAsync();

            // Initialize request argument(s)
            ListPreconfiguredExpressionSetsSecurityPoliciesRequest request = new ListPreconfiguredExpressionSetsSecurityPoliciesRequest
            {
                PageToken            = "",
                MaxResults           = 0U,
                Filter               = "",
                OrderBy              = "",
                Project              = "",
                ReturnPartialSuccess = false,
            };
            // Make the request
            SecurityPoliciesListPreconfiguredExpressionSetsResponse response = await securityPoliciesClient.ListPreconfiguredExpressionSetsAsync(request);

            // End snippet
        }
        public async stt::Task ListPreconfiguredExpressionSetsAsync()
        {
            moq::Mock <SecurityPolicies.SecurityPoliciesClient> mockGrpcClient = new moq::Mock <SecurityPolicies.SecurityPoliciesClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            ListPreconfiguredExpressionSetsSecurityPoliciesRequest request = new ListPreconfiguredExpressionSetsSecurityPoliciesRequest
            {
                Project = "projectaa6ff846",
            };
            SecurityPoliciesListPreconfiguredExpressionSetsResponse expectedResponse = new SecurityPoliciesListPreconfiguredExpressionSetsResponse
            {
                PreconfiguredExpressionSets = new SecurityPoliciesWafConfig(),
            };

            mockGrpcClient.Setup(x => x.ListPreconfiguredExpressionSetsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <SecurityPoliciesListPreconfiguredExpressionSetsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            SecurityPoliciesClient client = new SecurityPoliciesClientImpl(mockGrpcClient.Object, null);
            SecurityPoliciesListPreconfiguredExpressionSetsResponse responseCallSettings = await client.ListPreconfiguredExpressionSetsAsync(request.Project, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            SecurityPoliciesListPreconfiguredExpressionSetsResponse responseCancellationToken = await client.ListPreconfiguredExpressionSetsAsync(request.Project, st::CancellationToken.None);

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