Exemplo n.º 1
0
        public async Task UpdateSinkAsync3()
        {
            Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict);
            UpdateSinkRequest request = new UpdateSinkRequest
            {
                SinkNameAsSinkNameOneof = SinkNameOneof.From(new SinkName("[PROJECT]", "[SINK]")),
                Sink = new LogSink(),
            };
            LogSink expectedResponse = new LogSink
            {
                Name = "name3373707",
                DestinationAsResourceName = new BillingName("[BILLING_ACCOUNT]"),
                Filter          = "filter-1274492040",
                WriterIdentity  = "writerIdentity775638794",
                IncludeChildren = true,
            };

            mockGrpcClient.Setup(x => x.UpdateSinkAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <LogSink>(Task.FromResult(expectedResponse), null, null, null, null));
            ConfigServiceV2Client client = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null);
            LogSink response             = await client.UpdateSinkAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 2
0
        public void UpdateSink()
        {
            Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict);
            UpdateSinkRequest expectedRequest = new UpdateSinkRequest
            {
                SinkNameAsSinkNameOneof = SinkNameOneof.From(new SinkName("[PROJECT]", "[SINK]")),
                Sink       = new LogSink(),
                UpdateMask = new FieldMask(),
            };
            LogSink expectedResponse = new LogSink
            {
                Name = "name3373707",
                DestinationAsResourceName = new BillingName("[BILLING_ACCOUNT]"),
                Filter          = "filter-1274492040",
                WriterIdentity  = "writerIdentity775638794",
                IncludeChildren = true,
            };

            mockGrpcClient.Setup(x => x.UpdateSink(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ConfigServiceV2Client client   = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null);
            SinkNameOneof         sinkName = SinkNameOneof.From(new SinkName("[PROJECT]", "[SINK]"));
            LogSink   sink       = new LogSink();
            FieldMask updateMask = new FieldMask();
            LogSink   response   = client.UpdateSink(sinkName, sink, updateMask);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for UpdateSink</summary>
 public void UpdateSink_RequestObject()
 {
     // Snippet: UpdateSink(UpdateSinkRequest,CallSettings)
     // Create client
     ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.Create();
     // Initialize request argument(s)
     UpdateSinkRequest request = new UpdateSinkRequest
     {
         SinkNameAsSinkNameOneof = SinkNameOneof.From(new SinkName("[PROJECT]", "[SINK]")),
         Sink = new LogSink(),
     };
     // Make the request
     LogSink response = configServiceV2Client.UpdateSink(request);
     // End snippet
 }
        /// <summary>Snippet for UpdateSinkAsync</summary>
        public async Task UpdateSinkAsync_RequestObject()
        {
            // Snippet: UpdateSinkAsync(UpdateSinkRequest,CallSettings)
            // Additional: UpdateSinkAsync(UpdateSinkRequest,CancellationToken)
            // Create client
            ConfigServiceV2Client configServiceV2Client = await ConfigServiceV2Client.CreateAsync();

            // Initialize request argument(s)
            UpdateSinkRequest request = new UpdateSinkRequest
            {
                SinkNameAsSinkNameOneof = SinkNameOneof.From(new SinkName("[PROJECT]", "[SINK]")),
                Sink = new LogSink(),
            };
            // Make the request
            LogSink response = await configServiceV2Client.UpdateSinkAsync(request);

            // End snippet
        }