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(); }
/// <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 }
/// <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 }
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(); }
/// <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)); }
partial void Modify_TestIamPermissionsLicenseCodeRequest(ref TestIamPermissionsLicenseCodeRequest request, ref gaxgrpc::CallSettings settings);
/// <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));
/// <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();