public async stt::Task TestIamPermissionsAsync()
        {
            moq::Mock <NodeTemplates.NodeTemplatesClient> mockGrpcClient = new moq::Mock <NodeTemplates.NodeTemplatesClient>(moq::MockBehavior.Strict);
            TestIamPermissionsNodeTemplateRequest         request        = new TestIamPermissionsNodeTemplateRequest
            {
                Region   = "regionedb20d96",
                Resource = "resource164eab96",
                Project  = "projectaa6ff846",
                TestPermissionsRequestResource = new TestPermissionsRequest(),
            };
            TestPermissionsResponse expectedResponse = new TestPermissionsResponse
            {
                Permissions =
                {
                    "permissions535a2741",
                },
            };

            mockGrpcClient.Setup(x => x.TestIamPermissionsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <TestPermissionsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            NodeTemplatesClient     client = new NodeTemplatesClientImpl(mockGrpcClient.Object, null);
            TestPermissionsResponse responseCallSettings = await client.TestIamPermissionsAsync(request.Project, request.Region, request.Resource, request.TestPermissionsRequestResource, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            TestPermissionsResponse responseCancellationToken = await client.TestIamPermissionsAsync(request.Project, request.Region, request.Resource, request.TestPermissionsRequestResource, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void TestIamPermissions()
        {
            moq::Mock <NodeTemplates.NodeTemplatesClient> mockGrpcClient = new moq::Mock <NodeTemplates.NodeTemplatesClient>(moq::MockBehavior.Strict);
            TestIamPermissionsNodeTemplateRequest         request        = new TestIamPermissionsNodeTemplateRequest
            {
                Region   = "regionedb20d96",
                Resource = "resource164eab96",
                Project  = "projectaa6ff846",
                TestPermissionsRequestResource = new TestPermissionsRequest(),
            };
            TestPermissionsResponse expectedResponse = new TestPermissionsResponse
            {
                Permissions =
                {
                    "permissions535a2741",
                },
            };

            mockGrpcClient.Setup(x => x.TestIamPermissions(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            NodeTemplatesClient     client   = new NodeTemplatesClientImpl(mockGrpcClient.Object, null);
            TestPermissionsResponse response = client.TestIamPermissions(request.Project, request.Region, request.Resource, request.TestPermissionsRequestResource);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Esempio n. 3
0
 /// <summary>Snippet for TestIamPermissions</summary>
 public void TestIamPermissionsRequestObject()
 {
     // Snippet: TestIamPermissions(TestIamPermissionsNodeTemplateRequest, CallSettings)
     // Create client
     NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.Create();
     // Initialize request argument(s)
     TestIamPermissionsNodeTemplateRequest request = new TestIamPermissionsNodeTemplateRequest
     {
         Region   = "",
         Resource = "",
         Project  = "",
         TestPermissionsRequestResource = new TestPermissionsRequest(),
     };
     // Make the request
     TestPermissionsResponse response = nodeTemplatesClient.TestIamPermissions(request);
     // End snippet
 }
Esempio n. 4
0
        /// <summary>Snippet for TestIamPermissionsAsync</summary>
        public async Task TestIamPermissionsRequestObjectAsync()
        {
            // Snippet: TestIamPermissionsAsync(TestIamPermissionsNodeTemplateRequest, CallSettings)
            // Additional: TestIamPermissionsAsync(TestIamPermissionsNodeTemplateRequest, CancellationToken)
            // Create client
            NodeTemplatesClient nodeTemplatesClient = await NodeTemplatesClient.CreateAsync();

            // Initialize request argument(s)
            TestIamPermissionsNodeTemplateRequest request = new TestIamPermissionsNodeTemplateRequest
            {
                Region   = "",
                Resource = "",
                Project  = "",
                TestPermissionsRequestResource = new TestPermissionsRequest(),
            };
            // Make the request
            TestPermissionsResponse response = await nodeTemplatesClient.TestIamPermissionsAsync(request);

            // End snippet
        }