示例#1
0
        public async stt::Task TestIamPermissionsAsync()
        {
            moq::Mock <LicenseCodes.LicenseCodesClient> mockGrpcClient = new moq::Mock <LicenseCodes.LicenseCodesClient>(moq::MockBehavior.Strict);
            TestIamPermissionsLicenseCodeRequest        request        = new TestIamPermissionsLicenseCodeRequest
            {
                TestPermissionsRequestResource = new TestPermissionsRequest(),
                Resource = "resource164eab96",
                Project  = "projectaa6ff846",
            };
            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));
            LicenseCodesClient      client = new LicenseCodesClientImpl(mockGrpcClient.Object, null);
            TestPermissionsResponse responseCallSettings = await client.TestIamPermissionsAsync(request.Project, request.Resource, request.TestPermissionsRequestResource, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
示例#2
0
 /// <summary>Snippet for TestIamPermissions</summary>
 public void TestIamPermissionsRequestObject()
 {
     // Snippet: TestIamPermissions(TestIamPermissionsLicenseCodeRequest, CallSettings)
     // Create client
     LicenseCodesClient licenseCodesClient = LicenseCodesClient.Create();
     // Initialize request argument(s)
     TestIamPermissionsLicenseCodeRequest request = new TestIamPermissionsLicenseCodeRequest
     {
         Resource = "",
         Project  = "",
         TestPermissionsRequestResource = new TestPermissionsRequest(),
     };
     // Make the request
     TestPermissionsResponse response = licenseCodesClient.TestIamPermissions(request);
     // End snippet
 }
示例#3
0
        /// <summary>Snippet for TestIamPermissionsAsync</summary>
        public async Task TestIamPermissionsRequestObjectAsync()
        {
            // Snippet: TestIamPermissionsAsync(TestIamPermissionsLicenseCodeRequest, CallSettings)
            // Additional: TestIamPermissionsAsync(TestIamPermissionsLicenseCodeRequest, CancellationToken)
            // Create client
            LicenseCodesClient licenseCodesClient = await LicenseCodesClient.CreateAsync();

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

            // End snippet
        }
示例#4
0
        public void TestIamPermissions()
        {
            moq::Mock <LicenseCodes.LicenseCodesClient> mockGrpcClient = new moq::Mock <LicenseCodes.LicenseCodesClient>(moq::MockBehavior.Strict);
            TestIamPermissionsLicenseCodeRequest        request        = new TestIamPermissionsLicenseCodeRequest
            {
                TestPermissionsRequestResource = new TestPermissionsRequest(),
                Resource = "resource164eab96",
                Project  = "projectaa6ff846",
            };
            TestPermissionsResponse expectedResponse = new TestPermissionsResponse
            {
                Permissions =
                {
                    "permissions535a2741",
                },
            };

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

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#5
0
 /// <summary>
 /// Returns permissions that a caller has on the specified resource. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images.
 /// </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 <TestPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsLicenseCodeRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_TestIamPermissionsLicenseCodeRequest(ref request, ref callSettings);
     return(_callTestIamPermissions.Async(request, callSettings));
 }
示例#6
0
 partial void Modify_TestIamPermissionsLicenseCodeRequest(ref TestIamPermissionsLicenseCodeRequest request, ref gaxgrpc::CallSettings settings);
示例#7
0
 /// <summary>
 /// Returns permissions that a caller has on the specified resource. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images.
 /// </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 <TestPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsLicenseCodeRequest request, st::CancellationToken cancellationToken) =>
 TestIamPermissionsAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
示例#8
0
 /// <summary>
 /// Returns permissions that a caller has on the specified resource. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images.
 /// </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 <TestPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsLicenseCodeRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();