예제 #1
0
        public async stt::Task ProcessDocumentRequestObjectAsync()
        {
            moq::Mock <DocumentProcessorService.DocumentProcessorServiceClient> mockGrpcClient = new moq::Mock <DocumentProcessorService.DocumentProcessorServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            ProcessRequest request = new ProcessRequest
            {
                ProcessorName   = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"),
                SkipHumanReview = true,
                InlineDocument  = new Document(),
                RawDocument     = new RawDocument(),
            };
            ProcessResponse expectedResponse = new ProcessResponse
            {
                Document          = new Document(),
                HumanReviewStatus = new HumanReviewStatus(),
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for BatchProcessDocumentsAsync</summary>
        public async Task BatchProcessDocumentsResourceNamesAsync()
        {
            // Snippet: BatchProcessDocumentsAsync(ProcessorName, CallSettings)
            // Additional: BatchProcessDocumentsAsync(ProcessorName, CancellationToken)
            // Create client
            DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();

            // Initialize request argument(s)
            ProcessorName name = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
            // Make the request
            Operation <BatchProcessResponse, BatchProcessMetadata> response = await documentProcessorServiceClient.BatchProcessDocumentsAsync(name);

            // Poll until the returned long-running operation is complete
            Operation <BatchProcessResponse, BatchProcessMetadata> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            BatchProcessResponse result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <BatchProcessResponse, BatchProcessMetadata> retrievedResponse = await documentProcessorServiceClient.PollOnceBatchProcessDocumentsAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                BatchProcessResponse retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
예제 #3
0
        public void ProcessDocumentRequestObject()
        {
            moq::Mock <DocumentProcessorService.DocumentProcessorServiceClient> mockGrpcClient = new moq::Mock <DocumentProcessorService.DocumentProcessorServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            ProcessRequest request = new ProcessRequest
            {
                ProcessorName   = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"),
                SkipHumanReview = true,
                InlineDocument  = new Document(),
                RawDocument     = new RawDocument(),
            };
            ProcessResponse expectedResponse = new ProcessResponse
            {
                Document          = new Document(),
                HumanReviewStatus = new HumanReviewStatus(),
            };

            mockGrpcClient.Setup(x => x.ProcessDocument(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            DocumentProcessorServiceClient client = new DocumentProcessorServiceClientImpl(mockGrpcClient.Object, null);
            ProcessResponse response = client.ProcessDocument(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for BatchProcessDocuments</summary>
        public void BatchProcessDocumentsRequestObject()
        {
            // Snippet: BatchProcessDocuments(BatchProcessRequest, CallSettings)
            // Create client
            DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.Create();
            // Initialize request argument(s)
            BatchProcessRequest request = new BatchProcessRequest
            {
                ProcessorName        = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"),
                SkipHumanReview      = false,
                InputDocuments       = new BatchDocumentsInputConfig(),
                DocumentOutputConfig = new DocumentOutputConfig(),
            };
            // Make the request
            Operation <BatchProcessResponse, BatchProcessMetadata> response = documentProcessorServiceClient.BatchProcessDocuments(request);

            // Poll until the returned long-running operation is complete
            Operation <BatchProcessResponse, BatchProcessMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            BatchProcessResponse result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <BatchProcessResponse, BatchProcessMetadata> retrievedResponse = documentProcessorServiceClient.PollOnceBatchProcessDocuments(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                BatchProcessResponse retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        public async stt::Task CreateProcessorResourceNamesAsync()
        {
            moq::Mock <DocumentProcessorService.DocumentProcessorServiceClient> mockGrpcClient = new moq::Mock <DocumentProcessorService.DocumentProcessorServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            CreateProcessorRequest request = new CreateProcessorRequest
            {
                ParentAsLocationName = gagr::LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                Processor            = new Processor(),
            };
            Processor expectedResponse = new Processor
            {
                ProcessorName           = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"),
                Type                    = "typee2cc9d59",
                DisplayName             = "display_name137f65c2",
                State                   = Processor.Types.State.Failed,
                ProcessEndpoint         = "process_endpoint4445f26d",
                CreateTime              = new wkt::Timestamp(),
                KmsKeyName              = "kms_key_name06bd122b",
                DefaultProcessorVersion = "default_processor_versiona99cda5e",
            };

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

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Processor responseCancellationToken = await client.CreateProcessorAsync(request.ParentAsLocationName, request.Processor, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void CreateProcessorRequestObject()
        {
            moq::Mock <DocumentProcessorService.DocumentProcessorServiceClient> mockGrpcClient = new moq::Mock <DocumentProcessorService.DocumentProcessorServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            CreateProcessorRequest request = new CreateProcessorRequest
            {
                ParentAsLocationName = gagr::LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                Processor            = new Processor(),
            };
            Processor expectedResponse = new Processor
            {
                ProcessorName           = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"),
                Type                    = "typee2cc9d59",
                DisplayName             = "display_name137f65c2",
                State                   = Processor.Types.State.Failed,
                ProcessEndpoint         = "process_endpoint4445f26d",
                CreateTime              = new wkt::Timestamp(),
                KmsKeyName              = "kms_key_name06bd122b",
                DefaultProcessorVersion = "default_processor_versiona99cda5e",
            };

            mockGrpcClient.Setup(x => x.CreateProcessor(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            DocumentProcessorServiceClient client = new DocumentProcessorServiceClientImpl(mockGrpcClient.Object, null);
            Processor response = client.CreateProcessor(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void ProcessDocumentResourceNames()
        {
            moq::Mock <DocumentProcessorService.DocumentProcessorServiceClient> mockGrpcClient = new moq::Mock <DocumentProcessorService.DocumentProcessorServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            ProcessRequest request = new ProcessRequest
            {
                ProcessorName = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"),
            };
            ProcessResponse expectedResponse = new ProcessResponse
            {
                Document = new Document(),
#pragma warning disable CS0612
                HumanReviewOperation = "human_review_operationb1fb7921",
#pragma warning restore CS0612
                HumanReviewStatus = new HumanReviewStatus(),
            };

            mockGrpcClient.Setup(x => x.ProcessDocument(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            DocumentProcessorServiceClient client = new DocumentProcessorServiceClientImpl(mockGrpcClient.Object, null);
            ProcessResponse response = client.ProcessDocument(request.ProcessorName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
예제 #8
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (ProcessorName != null ? ProcessorName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ProcessedAt.GetHashCode();
         return(hashCode);
     }
 }
 /// <summary>Snippet for ProcessDocument</summary>
 public void ProcessDocumentResourceNames()
 {
     // Snippet: ProcessDocument(ProcessorName, CallSettings)
     // Create client
     DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.Create();
     // Initialize request argument(s)
     ProcessorName name = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
     // Make the request
     ProcessResponse response = documentProcessorServiceClient.ProcessDocument(name);
     // End snippet
 }
        /// <summary>Snippet for ProcessDocumentAsync</summary>
        public async Task ProcessDocumentResourceNamesAsync()
        {
            // Snippet: ProcessDocumentAsync(ProcessorName, CallSettings)
            // Additional: ProcessDocumentAsync(ProcessorName, CancellationToken)
            // Create client
            DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();

            // Initialize request argument(s)
            ProcessorName name = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
            // Make the request
            ProcessResponse response = await documentProcessorServiceClient.ProcessDocumentAsync(name);

            // End snippet
        }
 /// <summary>Snippet for ProcessDocument</summary>
 public void ProcessDocumentRequestObject()
 {
     // Snippet: ProcessDocument(ProcessRequest, CallSettings)
     // Create client
     DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.Create();
     // Initialize request argument(s)
     ProcessRequest request = new ProcessRequest
     {
         ProcessorName   = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"),
         SkipHumanReview = false,
         InlineDocument  = new Document(),
     };
     // Make the request
     ProcessResponse response = documentProcessorServiceClient.ProcessDocument(request);
     // End snippet
 }
예제 #12
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (BillingAddress != null ? BillingAddress.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CardBrand != null ? CardBrand.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CardExpMonth.GetHashCode();
         hashCode = (hashCode * 397) ^ CardExpYear.GetHashCode();
         hashCode = (hashCode * 397) ^ (CardLast4 != null ? CardLast4.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CustomerId.GetHashCode();
         hashCode = (hashCode * 397) ^ HasCardErrorInDunning.GetHashCode();
         hashCode = (hashCode * 397) ^ (PaymentType != null ? PaymentType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ProcessorName != null ? ProcessorName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StatusReason != null ? StatusReason.GetHashCode() : 0);
         return(hashCode);
     }
 }
        /// <summary>Snippet for ProcessDocumentAsync</summary>
        public async Task ProcessDocumentRequestObjectAsync()
        {
            // Snippet: ProcessDocumentAsync(ProcessRequest, CallSettings)
            // Additional: ProcessDocumentAsync(ProcessRequest, CancellationToken)
            // Create client
            DocumentProcessorServiceClient documentProcessorServiceClient = await DocumentProcessorServiceClient.CreateAsync();

            // Initialize request argument(s)
            ProcessRequest request = new ProcessRequest
            {
                ProcessorName   = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"),
                SkipHumanReview = false,
                InlineDocument  = new Document(),
            };
            // Make the request
            ProcessResponse response = await documentProcessorServiceClient.ProcessDocumentAsync(request);

            // End snippet
        }
예제 #14
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = AddressId.GetHashCode();
         hashCode = (hashCode * 397) ^ (AnalyticsData != null ? AnalyticsData.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingAddress != null ? BillingAddress.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ClientDetails != null ? ClientDetails.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CreatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ (CustomerHash != null ? CustomerHash.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CustomerId.GetHashCode();
         hashCode = (hashCode * 397) ^ (Email != null ? Email.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FirstName != null ? FirstName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ HasUncommitedChanges.GetHashCode();
         hashCode = (hashCode * 397) ^ Id.GetHashCode();
         hashCode = (hashCode * 397) ^ (LastName != null ? LastName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Note != null ? Note.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ProcessedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ (ProcessorName != null ? ProcessorName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ScheduledAt.GetHashCode();
         hashCode = (hashCode * 397) ^ ShipmentsCount.GetHashCode();
         hashCode = (hashCode * 397) ^ (ShippingAddress != null ? ShippingAddress.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ShopifyOrderId.GetHashCode();
         hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SubTotal != null ? SubTotal.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ SubtotalPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ (Tags != null ? Tags.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TaxLines.GetHashCode();
         hashCode = (hashCode * 397) ^ (TotalDiscounts != null ? TotalDiscounts.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TotalLineItemsPrice != null ? TotalLineItemsPrice.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TotalPrice != null ? TotalPrice.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TotalRefunds != null ? TotalRefunds.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TotalTax.GetHashCode();
         hashCode = (hashCode * 397) ^ TotalWeight.GetHashCode();
         hashCode = (hashCode * 397) ^ (TransactionId != null ? TransactionId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Type != null ? Type.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ UpdatedAt.GetHashCode();
         return(hashCode);
     }
 }