Exemplo n.º 1
0
 /// <summary>Snippet for GetInspectTemplate</summary>
 public void GetInspectTemplate_RequestObject()
 {
     // Snippet: GetInspectTemplate(GetInspectTemplateRequest,CallSettings)
     // Create client
     DlpServiceClient dlpServiceClient = DlpServiceClient.Create();
     // Initialize request argument(s)
     GetInspectTemplateRequest request = new GetInspectTemplateRequest();
     // Make the request
     InspectTemplate response = dlpServiceClient.GetInspectTemplate(request);
     // End snippet
 }
Exemplo n.º 2
0
        /// <summary>Snippet for GetInspectTemplateAsync</summary>
        public async Task GetInspectTemplateAsync_RequestObject()
        {
            // Snippet: GetInspectTemplateAsync(GetInspectTemplateRequest,CallSettings)
            // Additional: GetInspectTemplateAsync(GetInspectTemplateRequest,CancellationToken)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetInspectTemplateRequest request = new GetInspectTemplateRequest();
            // Make the request
            InspectTemplate response = await dlpServiceClient.GetInspectTemplateAsync(request);

            // End snippet
        }
        public async Task GetInspectTemplateAsync()
        {
            Mock <DlpService.DlpServiceClient> mockGrpcClient = new Mock <DlpService.DlpServiceClient>(MockBehavior.Strict);
            GetInspectTemplateRequest          request        = new GetInspectTemplateRequest();
            InspectTemplate expectedResponse = new InspectTemplate
            {
                Name        = "name3373707",
                DisplayName = "displayName1615086568",
                Description = "description-1724546052",
            };

            mockGrpcClient.Setup(x => x.GetInspectTemplateAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <InspectTemplate>(Task.FromResult(expectedResponse), null, null, null, null));
            DlpServiceClient client   = new DlpServiceClientImpl(mockGrpcClient.Object, null);
            InspectTemplate  response = await client.GetInspectTemplateAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetInspectTemplate()
        {
            Mock <DlpService.DlpServiceClient> mockGrpcClient = new Mock <DlpService.DlpServiceClient>(MockBehavior.Strict);
            GetInspectTemplateRequest          request        = new GetInspectTemplateRequest();
            InspectTemplate expectedResponse = new InspectTemplate
            {
                Name        = "name3373707",
                DisplayName = "displayName1615086568",
                Description = "description-1724546052",
            };

            mockGrpcClient.Setup(x => x.GetInspectTemplate(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            DlpServiceClient client   = new DlpServiceClientImpl(mockGrpcClient.Object, null);
            InspectTemplate  response = client.GetInspectTemplate(request);

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