public void TestIamPermissionsResourceNames()
        {
            moq::Mock <ContainerAnalysis.ContainerAnalysisClient> mockGrpcClient = new moq::Mock <ContainerAnalysis.ContainerAnalysisClient>(moq::MockBehavior.Strict);
            gciv::TestIamPermissionsRequest request = new gciv::TestIamPermissionsRequest
            {
                ResourceAsResourceName = new gax::UnparsedResourceName("a/wildcard/resource"),
                Permissions            =
                {
                    "permissions535a2741",
                },
            };
            gciv::TestIamPermissionsResponse expectedResponse = new gciv::TestIamPermissionsResponse
            {
                Permissions =
                {
                    "permissions535a2741",
                },
            };

            mockGrpcClient.Setup(x => x.TestIamPermissions(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ContainerAnalysisClient          client   = new ContainerAnalysisClientImpl(mockGrpcClient.Object, null);
            gciv::TestIamPermissionsResponse response = client.TestIamPermissions(request.ResourceAsResourceName, request.Permissions);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #2
0
        public void TestIamPermissions2()
        {
            Mock <ContainerAnalysis.ContainerAnalysisClient> mockGrpcClient = new Mock <ContainerAnalysis.ContainerAnalysisClient>(MockBehavior.Strict);
            TestIamPermissionsRequest request = new TestIamPermissionsRequest
            {
                ResourceAsResourceName = IamResourceNameOneof.From(new NoteName("[PROJECT]", "[NOTE]")),
                Permissions            = { },
            };
            TestIamPermissionsResponse expectedResponse = new TestIamPermissionsResponse();

            mockGrpcClient.Setup(x => x.TestIamPermissions(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ContainerAnalysisClient    client   = new ContainerAnalysisClientImpl(mockGrpcClient.Object, null);
            TestIamPermissionsResponse response = client.TestIamPermissions(request);

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