Esempio n. 1
0
        public async stt::Task TroubleshootIamPolicyRequestObjectAsync()
        {
            moq::Mock <IamChecker.IamCheckerClient> mockGrpcClient = new moq::Mock <IamChecker.IamCheckerClient>(moq::MockBehavior.Strict);
            TroubleshootIamPolicyRequest            request        = new TroubleshootIamPolicyRequest
            {
                AccessTuple = new AccessTuple(),
            };
            TroubleshootIamPolicyResponse expectedResponse = new TroubleshootIamPolicyResponse
            {
                Access            = AccessState.UnknownInfoDenied,
                ExplainedPolicies =
                {
                    new ExplainedPolicy(),
                },
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for TroubleshootIamPolicy</summary>
 public void TroubleshootIamPolicyRequestObject()
 {
     // Snippet: TroubleshootIamPolicy(TroubleshootIamPolicyRequest, CallSettings)
     // Create client
     IamCheckerClient iamCheckerClient = IamCheckerClient.Create();
     // Initialize request argument(s)
     TroubleshootIamPolicyRequest request = new TroubleshootIamPolicyRequest
     {
         AccessTuple = new AccessTuple(),
     };
     // Make the request
     TroubleshootIamPolicyResponse response = iamCheckerClient.TroubleshootIamPolicy(request);
     // End snippet
 }
        /// <summary>Snippet for TroubleshootIamPolicyAsync</summary>
        public async Task TroubleshootIamPolicyRequestObjectAsync()
        {
            // Snippet: TroubleshootIamPolicyAsync(TroubleshootIamPolicyRequest, CallSettings)
            // Additional: TroubleshootIamPolicyAsync(TroubleshootIamPolicyRequest, CancellationToken)
            // Create client
            IamCheckerClient iamCheckerClient = await IamCheckerClient.CreateAsync();

            // Initialize request argument(s)
            TroubleshootIamPolicyRequest request = new TroubleshootIamPolicyRequest
            {
                AccessTuple = new AccessTuple(),
            };
            // Make the request
            TroubleshootIamPolicyResponse response = await iamCheckerClient.TroubleshootIamPolicyAsync(request);

            // End snippet
        }
Esempio n. 4
0
        public void TroubleshootIamPolicyRequestObject()
        {
            moq::Mock <IamChecker.IamCheckerClient> mockGrpcClient = new moq::Mock <IamChecker.IamCheckerClient>(moq::MockBehavior.Strict);
            TroubleshootIamPolicyRequest            request        = new TroubleshootIamPolicyRequest
            {
                AccessTuple = new AccessTuple(),
            };
            TroubleshootIamPolicyResponse expectedResponse = new TroubleshootIamPolicyResponse
            {
                Access            = AccessState.UnknownInfoDenied,
                ExplainedPolicies =
                {
                    new ExplainedPolicy(),
                },
            };

            mockGrpcClient.Setup(x => x.TroubleshootIamPolicy(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            IamCheckerClient client = new IamCheckerClientImpl(mockGrpcClient.Object, null);
            TroubleshootIamPolicyResponse response = client.TroubleshootIamPolicy(request);

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