Beispiel #1
0
        public async stt::Task GetScanRunRequestObjectAsync()
        {
            moq::Mock <WebSecurityScanner.WebSecurityScannerClient> mockGrpcClient = new moq::Mock <WebSecurityScanner.WebSecurityScannerClient>(moq::MockBehavior.Strict);
            GetScanRunRequest request = new GetScanRunRequest
            {
                Name = "name1c9368b0",
            };
            ScanRun expectedResponse = new ScanRun
            {
                Name               = "name1c9368b0",
                ExecutionState     = ScanRun.Types.ExecutionState.Unspecified,
                ResultState        = ScanRun.Types.ResultState.Killed,
                StartTime          = new wkt::Timestamp(),
                EndTime            = new wkt::Timestamp(),
                UrlsCrawledCount   = 2307837720024124869L,
                UrlsTestedCount    = -373604950692105735L,
                HasVulnerabilities = true,
                ProgressPercent    = -412774427,
                ErrorTrace         = new ScanRunErrorTrace(),
                WarningTraces      =
                {
                    new ScanRunWarningTrace(),
                },
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Beispiel #2
0
        public void GetScanRunRequestObject()
        {
            moq::Mock <WebSecurityScanner.WebSecurityScannerClient> mockGrpcClient = new moq::Mock <WebSecurityScanner.WebSecurityScannerClient>(moq::MockBehavior.Strict);
            GetScanRunRequest request = new GetScanRunRequest
            {
                Name = "name1c9368b0",
            };
            ScanRun expectedResponse = new ScanRun
            {
                Name               = "name1c9368b0",
                ExecutionState     = ScanRun.Types.ExecutionState.Unspecified,
                ResultState        = ScanRun.Types.ResultState.Killed,
                StartTime          = new wkt::Timestamp(),
                EndTime            = new wkt::Timestamp(),
                UrlsCrawledCount   = 2307837720024124869L,
                UrlsTestedCount    = -373604950692105735L,
                HasVulnerabilities = true,
                ProgressPercent    = -412774427,
                ErrorTrace         = new ScanRunErrorTrace(),
                WarningTraces      =
                {
                    new ScanRunWarningTrace(),
                },
            };

            mockGrpcClient.Setup(x => x.GetScanRun(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            WebSecurityScannerClient client = new WebSecurityScannerClientImpl(mockGrpcClient.Object, null);
            ScanRun response = client.GetScanRun(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for GetScanRun</summary>
 public void GetScanRunRequestObject()
 {
     // Snippet: GetScanRun(GetScanRunRequest, CallSettings)
     // Create client
     WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.Create();
     // Initialize request argument(s)
     GetScanRunRequest request = new GetScanRunRequest {
         Name = "",
     };
     // Make the request
     ScanRun response = webSecurityScannerClient.GetScanRun(request);
     // End snippet
 }
        /// <summary>Snippet for GetScanRunAsync</summary>
        public async Task GetScanRunRequestObjectAsync()
        {
            // Snippet: GetScanRunAsync(GetScanRunRequest, CallSettings)
            // Additional: GetScanRunAsync(GetScanRunRequest, CancellationToken)
            // Create client
            WebSecurityScannerClient webSecurityScannerClient = await WebSecurityScannerClient.CreateAsync();

            // Initialize request argument(s)
            GetScanRunRequest request = new GetScanRunRequest {
                Name = "",
            };
            // Make the request
            ScanRun response = await webSecurityScannerClient.GetScanRunAsync(request);

            // End snippet
        }