コード例 #1
0
        public async stt::Task GetVulnerabilityOccurrencesSummaryResourceNamesAsync()
        {
            moq::Mock <ContainerAnalysis.ContainerAnalysisClient> mockGrpcClient = new moq::Mock <ContainerAnalysis.ContainerAnalysisClient>(moq::MockBehavior.Strict);
            GetVulnerabilityOccurrencesSummaryRequest             request        = new GetVulnerabilityOccurrencesSummaryRequest
            {
                ParentAsProjectName = gagr::ProjectName.FromProject("[PROJECT]"),
                Filter = "filtere47ac9b2",
            };
            VulnerabilityOccurrencesSummary expectedResponse = new VulnerabilityOccurrencesSummary
            {
                Counts =
                {
                    new VulnerabilityOccurrencesSummary.Types.FixableTotalByDigest(),
                },
            };

            mockGrpcClient.Setup(x => x.GetVulnerabilityOccurrencesSummaryAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <VulnerabilityOccurrencesSummary>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            ContainerAnalysisClient         client = new ContainerAnalysisClientImpl(mockGrpcClient.Object, null);
            VulnerabilityOccurrencesSummary responseCallSettings = await client.GetVulnerabilityOccurrencesSummaryAsync(request.ParentAsProjectName, request.Filter, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            VulnerabilityOccurrencesSummary responseCancellationToken = await client.GetVulnerabilityOccurrencesSummaryAsync(request.ParentAsProjectName, request.Filter, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #2
0
 /// <summary>Snippet for GetVulnerabilityOccurrencesSummary</summary>
 public void GetVulnerabilityOccurrencesSummaryRequestObject()
 {
     // Snippet: GetVulnerabilityOccurrencesSummary(GetVulnerabilityOccurrencesSummaryRequest, CallSettings)
     // Create client
     ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.Create();
     // Initialize request argument(s)
     GetVulnerabilityOccurrencesSummaryRequest request = new GetVulnerabilityOccurrencesSummaryRequest
     {
         ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
         Filter = "",
     };
     // Make the request
     VulnerabilityOccurrencesSummary response = containerAnalysisClient.GetVulnerabilityOccurrencesSummary(request);
     // End snippet
 }
コード例 #3
0
        /// <summary>Snippet for GetVulnerabilityOccurrencesSummaryAsync</summary>
        public async Task GetVulnerabilityOccurrencesSummaryRequestObjectAsync()
        {
            // Snippet: GetVulnerabilityOccurrencesSummaryAsync(GetVulnerabilityOccurrencesSummaryRequest, CallSettings)
            // Additional: GetVulnerabilityOccurrencesSummaryAsync(GetVulnerabilityOccurrencesSummaryRequest, CancellationToken)
            // Create client
            ContainerAnalysisClient containerAnalysisClient = await ContainerAnalysisClient.CreateAsync();

            // Initialize request argument(s)
            GetVulnerabilityOccurrencesSummaryRequest request = new GetVulnerabilityOccurrencesSummaryRequest
            {
                ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
                Filter = "",
            };
            // Make the request
            VulnerabilityOccurrencesSummary response = await containerAnalysisClient.GetVulnerabilityOccurrencesSummaryAsync(request);

            // End snippet
        }
コード例 #4
0
        public void GetVulnerabilityOccurrencesSummaryResourceNames()
        {
            moq::Mock <ContainerAnalysis.ContainerAnalysisClient> mockGrpcClient = new moq::Mock <ContainerAnalysis.ContainerAnalysisClient>(moq::MockBehavior.Strict);
            GetVulnerabilityOccurrencesSummaryRequest             request        = new GetVulnerabilityOccurrencesSummaryRequest
            {
                ParentAsProjectName = gagr::ProjectName.FromProject("[PROJECT]"),
                Filter = "filtere47ac9b2",
            };
            VulnerabilityOccurrencesSummary expectedResponse = new VulnerabilityOccurrencesSummary
            {
                Counts =
                {
                    new VulnerabilityOccurrencesSummary.Types.FixableTotalByDigest(),
                },
            };

            mockGrpcClient.Setup(x => x.GetVulnerabilityOccurrencesSummary(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ContainerAnalysisClient         client   = new ContainerAnalysisClientImpl(mockGrpcClient.Object, null);
            VulnerabilityOccurrencesSummary response = client.GetVulnerabilityOccurrencesSummary(request.ParentAsProjectName, request.Filter);

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