Esempio n. 1
0
        public async stt::Task SearchHashesAsync()
        {
            moq::Mock <WebRiskServiceV1Beta1.WebRiskServiceV1Beta1Client> mockGrpcClient = new moq::Mock <WebRiskServiceV1Beta1.WebRiskServiceV1Beta1Client>(moq::MockBehavior.Strict);
            SearchHashesRequest request = new SearchHashesRequest
            {
                HashPrefix  = proto::ByteString.CopyFromUtf8("hash_prefix0c2a6688"),
                ThreatTypes =
                {
                    ThreatType.SocialEngineering,
                },
            };
            SearchHashesResponse expectedResponse = new SearchHashesResponse
            {
                Threats =
                {
                    new SearchHashesResponse.Types.ThreatHash(),
                },
                NegativeExpireTime = new wkt::Timestamp(),
            };

            mockGrpcClient.Setup(x => x.SearchHashesAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <SearchHashesResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            WebRiskServiceV1Beta1Client client = new WebRiskServiceV1Beta1ClientImpl(mockGrpcClient.Object, null);
            SearchHashesResponse        responseCallSettings = await client.SearchHashesAsync(request.HashPrefix, request.ThreatTypes, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            SearchHashesResponse responseCancellationToken = await client.SearchHashesAsync(request.HashPrefix, request.ThreatTypes, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>
 /// Gets the full hashes that match the requested hash prefix.
 /// This is used after a hash prefix is looked up in a threatList
 /// and there is a match. The client side threatList only holds partial hashes
 /// so the client must query this method to determine if there is a full
 /// hash match of a threat.
 /// </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 <SearchHashesResponse> SearchHashesAsync(
     SearchHashesRequest request,
     gaxgrpc::CallSettings callSettings = null)
 {
     Modify_SearchHashesRequest(ref request, ref callSettings);
     return(_callSearchHashes.Async(request, callSettings));
 }
Esempio n. 3
0
        public void SearchHashes()
        {
            moq::Mock <WebRiskServiceV1Beta1.WebRiskServiceV1Beta1Client> mockGrpcClient = new moq::Mock <WebRiskServiceV1Beta1.WebRiskServiceV1Beta1Client>(moq::MockBehavior.Strict);
            SearchHashesRequest request = new SearchHashesRequest
            {
                HashPrefix  = proto::ByteString.CopyFromUtf8("hash_prefix0c2a6688"),
                ThreatTypes =
                {
                    ThreatType.SocialEngineering,
                },
            };
            SearchHashesResponse expectedResponse = new SearchHashesResponse
            {
                Threats =
                {
                    new SearchHashesResponse.Types.ThreatHash(),
                },
                NegativeExpireTime = new wkt::Timestamp(),
            };

            mockGrpcClient.Setup(x => x.SearchHashes(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            WebRiskServiceV1Beta1Client client   = new WebRiskServiceV1Beta1ClientImpl(mockGrpcClient.Object, null);
            SearchHashesResponse        response = client.SearchHashes(request.HashPrefix, request.ThreatTypes);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>
 /// Gets the full hashes that match the requested hash prefix.
 /// This is used after a hash prefix is looked up in a threatList
 /// and there is a match. The client side threatList only holds partial hashes
 /// so the client must query this method to determine if there is a full
 /// hash match of a threat.
 /// </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>
 /// The RPC response.
 /// </returns>
 public override SearchHashesResponse SearchHashes(
     SearchHashesRequest request,
     gaxgrpc::CallSettings callSettings = null)
 {
     Modify_SearchHashesRequest(ref request, ref callSettings);
     return(_callSearchHashes.Sync(request, callSettings));
 }
 /// <summary>Snippet for SearchHashes</summary>
 public void SearchHashes_RequestObject()
 {
     // Snippet: SearchHashes(SearchHashesRequest,CallSettings)
     // Create client
     WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.Create();
     // Initialize request argument(s)
     SearchHashesRequest request = new SearchHashesRequest();
     // Make the request
     SearchHashesResponse response = webRiskServiceV1Beta1Client.SearchHashes(request);
     // End snippet
 }
        /// <summary>Snippet for SearchHashesAsync</summary>
        public async Task SearchHashesAsync_RequestObject()
        {
            // Snippet: SearchHashesAsync(SearchHashesRequest,CallSettings)
            // Additional: SearchHashesAsync(SearchHashesRequest,CancellationToken)
            // Create client
            WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = await WebRiskServiceV1Beta1Client.CreateAsync();

            // Initialize request argument(s)
            SearchHashesRequest request = new SearchHashesRequest();
            // Make the request
            SearchHashesResponse response = await webRiskServiceV1Beta1Client.SearchHashesAsync(request);

            // End snippet
        }
Esempio n. 7
0
        public async Task SearchHashesAsync2()
        {
            Mock <WebRiskServiceV1Beta1.WebRiskServiceV1Beta1Client> mockGrpcClient = new Mock <WebRiskServiceV1Beta1.WebRiskServiceV1Beta1Client>(MockBehavior.Strict);
            SearchHashesRequest  request          = new SearchHashesRequest();
            SearchHashesResponse expectedResponse = new SearchHashesResponse();

            mockGrpcClient.Setup(x => x.SearchHashesAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <SearchHashesResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            WebRiskServiceV1Beta1Client client   = new WebRiskServiceV1Beta1ClientImpl(mockGrpcClient.Object, null);
            SearchHashesResponse        response = await client.SearchHashesAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Esempio n. 8
0
        public void SearchHashes2()
        {
            Mock <WebRiskServiceV1Beta1.WebRiskServiceV1Beta1Client> mockGrpcClient = new Mock <WebRiskServiceV1Beta1.WebRiskServiceV1Beta1Client>(MockBehavior.Strict);
            SearchHashesRequest  request          = new SearchHashesRequest();
            SearchHashesResponse expectedResponse = new SearchHashesResponse();

            mockGrpcClient.Setup(x => x.SearchHashes(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            WebRiskServiceV1Beta1Client client   = new WebRiskServiceV1Beta1ClientImpl(mockGrpcClient.Object, null);
            SearchHashesResponse        response = client.SearchHashes(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Esempio n. 9
0
 /// <summary>Snippet for SearchHashes</summary>
 public void SearchHashes_RequestObject()
 {
     // Snippet: SearchHashes(SearchHashesRequest, CallSettings)
     // Create client
     WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.Create();
     // Initialize request argument(s)
     SearchHashesRequest request = new SearchHashesRequest
     {
         HashPrefix  = ByteString.Empty,
         ThreatTypes =
         {
             ThreatType.Unspecified,
         },
     };
     // Make the request
     SearchHashesResponse response = webRiskServiceV1Beta1Client.SearchHashes(request);
     // End snippet
 }
Esempio n. 10
0
        public async Task SearchHashesAsync()
        {
            Mock <WebRiskServiceV1Beta1.WebRiskServiceV1Beta1Client> mockGrpcClient = new Mock <WebRiskServiceV1Beta1.WebRiskServiceV1Beta1Client>(MockBehavior.Strict);
            SearchHashesRequest expectedRequest = new SearchHashesRequest
            {
                HashPrefix  = ByteString.CopyFromUtf8("-29"),
                ThreatTypes = { },
            };
            SearchHashesResponse expectedResponse = new SearchHashesResponse();

            mockGrpcClient.Setup(x => x.SearchHashesAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <SearchHashesResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            WebRiskServiceV1Beta1Client client = new WebRiskServiceV1Beta1ClientImpl(mockGrpcClient.Object, null);
            ByteString hashPrefix = ByteString.CopyFromUtf8("-29");
            IEnumerable <ThreatType> threatTypes = new List <ThreatType>();
            SearchHashesResponse     response    = await client.SearchHashesAsync(hashPrefix, threatTypes);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Esempio n. 11
0
        /// <summary>Snippet for SearchHashesAsync</summary>
        public async Task SearchHashesAsync_RequestObject()
        {
            // Snippet: SearchHashesAsync(SearchHashesRequest, CallSettings)
            // Additional: SearchHashesAsync(SearchHashesRequest, CancellationToken)
            // Create client
            WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = await WebRiskServiceV1Beta1Client.CreateAsync();

            // Initialize request argument(s)
            SearchHashesRequest request = new SearchHashesRequest
            {
                HashPrefix  = ByteString.Empty,
                ThreatTypes =
                {
                    ThreatType.Unspecified,
                },
            };
            // Make the request
            SearchHashesResponse response = await webRiskServiceV1Beta1Client.SearchHashesAsync(request);

            // End snippet
        }
Esempio n. 12
0
 partial void Modify_SearchHashesRequest(ref SearchHashesRequest request, ref gaxgrpc::CallSettings settings);
Esempio n. 13
0
 /// <summary>
 /// Gets the full hashes that match the requested hash prefix.
 /// This is used after a hash prefix is looked up in a threatList
 /// and there is a match. The client side threatList only holds partial hashes
 /// so the client must query this method to determine if there is a full
 /// hash match of a threat.
 /// </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 <SearchHashesResponse> SearchHashesAsync(SearchHashesRequest request, st::CancellationToken cancellationToken) =>
 SearchHashesAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
Esempio n. 14
0
 /// <summary>
 /// Gets the full hashes that match the requested hash prefix.
 /// This is used after a hash prefix is looked up in a threatList
 /// and there is a match. The client side threatList only holds partial hashes
 /// so the client must query this method to determine if there is a full
 /// hash match of a threat.
 /// </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 <SearchHashesResponse> SearchHashesAsync(SearchHashesRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
 /// <summary>
 /// Gets the full hashes that match the requested hash prefix.
 /// This is used after a hash prefix is looked up in a threatList
 /// and there is a match. The client side threatList only holds partial hashes
 /// so the client must query this method to determine if there is a full
 /// hash match of a threat.
 /// </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>
 /// The RPC response.
 /// </returns>
 public virtual SearchHashesResponse SearchHashes(
     SearchHashesRequest request,
     gaxgrpc::CallSettings callSettings = null)
 {
     throw new sys::NotImplementedException();
 }