public async Task UpdateLogMetricAsync()
        {
            Mock <MetricsServiceV2.MetricsServiceV2Client> mockGrpcClient = new Mock <MetricsServiceV2.MetricsServiceV2Client>(MockBehavior.Strict);
            UpdateLogMetricRequest expectedRequest = new UpdateLogMetricRequest
            {
                MetricNameAsMetricNameOneof = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]")),
                Metric = new LogMetric(),
            };
            LogMetric expectedResponse = new LogMetric
            {
                MetricNameOneof = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]")),
                Description     = "description-1724546052",
                Filter          = "filter-1274492040",
                ValueExtractor  = "valueExtractor2047672534",
            };

            mockGrpcClient.Setup(x => x.UpdateLogMetricAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <LogMetric>(Task.FromResult(expectedResponse), null, null, null, null));
            MetricsServiceV2Client client     = new MetricsServiceV2ClientImpl(mockGrpcClient.Object, null);
            MetricNameOneof        metricName = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]"));
            LogMetric metric   = new LogMetric();
            LogMetric response = await client.UpdateLogMetricAsync(metricName, metric);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void CreateLogMetric()
        {
            Mock <MetricsServiceV2.MetricsServiceV2Client> mockGrpcClient = new Mock <MetricsServiceV2.MetricsServiceV2Client>(MockBehavior.Strict);
            CreateLogMetricRequest expectedRequest = new CreateLogMetricRequest
            {
                ParentAsParentNameOneof = ParentNameOneof.From(new ProjectName("[PROJECT]")),
                Metric = new LogMetric(),
            };
            LogMetric expectedResponse = new LogMetric
            {
                MetricNameOneof = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]")),
                Description     = "description-1724546052",
                Filter          = "filter-1274492040",
                ValueExtractor  = "valueExtractor2047672534",
            };

            mockGrpcClient.Setup(x => x.CreateLogMetric(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            MetricsServiceV2Client client = new MetricsServiceV2ClientImpl(mockGrpcClient.Object, null);
            ParentNameOneof        parent = ParentNameOneof.From(new ProjectName("[PROJECT]"));
            LogMetric metric   = new LogMetric();
            LogMetric response = client.CreateLogMetric(parent, metric);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#3
0
 /// <summary>Snippet for GetLogMetric</summary>
 public void GetLogMetric()
 {
     // Snippet: GetLogMetric(MetricNameOneof,CallSettings)
     // Create client
     MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
     // Initialize request argument(s)
     MetricNameOneof metricName = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]"));
     // Make the request
     LogMetric response = metricsServiceV2Client.GetLogMetric(metricName);
     // End snippet
 }
示例#4
0
        /// <summary>Snippet for DeleteLogMetricAsync</summary>
        public async Task DeleteLogMetricAsync()
        {
            // Snippet: DeleteLogMetricAsync(MetricNameOneof,CallSettings)
            // Additional: DeleteLogMetricAsync(MetricNameOneof,CancellationToken)
            // Create client
            MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();

            // Initialize request argument(s)
            MetricNameOneof metricName = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]"));
            // Make the request
            await metricsServiceV2Client.DeleteLogMetricAsync(metricName);

            // End snippet
        }
示例#5
0
 /// <summary>Snippet for GetLogMetric</summary>
 public void GetLogMetric_RequestObject()
 {
     // Snippet: GetLogMetric(GetLogMetricRequest,CallSettings)
     // Create client
     MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
     // Initialize request argument(s)
     GetLogMetricRequest request = new GetLogMetricRequest
     {
         MetricNameAsMetricNameOneof = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]")),
     };
     // Make the request
     LogMetric response = metricsServiceV2Client.GetLogMetric(request);
     // End snippet
 }
示例#6
0
        /// <summary>Snippet for UpdateLogMetricAsync</summary>
        public async Task UpdateLogMetricAsync()
        {
            // Snippet: UpdateLogMetricAsync(MetricNameOneof,LogMetric,CallSettings)
            // Additional: UpdateLogMetricAsync(MetricNameOneof,LogMetric,CancellationToken)
            // Create client
            MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();

            // Initialize request argument(s)
            MetricNameOneof metricName = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]"));
            LogMetric       metric     = new LogMetric();
            // Make the request
            LogMetric response = await metricsServiceV2Client.UpdateLogMetricAsync(metricName, metric);

            // End snippet
        }
        public async Task DeleteLogMetricAsync2()
        {
            Mock <MetricsServiceV2.MetricsServiceV2Client> mockGrpcClient = new Mock <MetricsServiceV2.MetricsServiceV2Client>(MockBehavior.Strict);
            DeleteLogMetricRequest request = new DeleteLogMetricRequest
            {
                MetricNameAsMetricNameOneof = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]")),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteLogMetricAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null));
            MetricsServiceV2Client client = new MetricsServiceV2ClientImpl(mockGrpcClient.Object, null);
            await client.DeleteLogMetricAsync(request);

            mockGrpcClient.VerifyAll();
        }
        public void DeleteLogMetric2()
        {
            Mock <MetricsServiceV2.MetricsServiceV2Client> mockGrpcClient = new Mock <MetricsServiceV2.MetricsServiceV2Client>(MockBehavior.Strict);
            DeleteLogMetricRequest request = new DeleteLogMetricRequest
            {
                MetricNameAsMetricNameOneof = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]")),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteLogMetric(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            MetricsServiceV2Client client = new MetricsServiceV2ClientImpl(mockGrpcClient.Object, null);

            client.DeleteLogMetric(request);
            mockGrpcClient.VerifyAll();
        }
        public async Task DeleteLogMetricAsync_RequestObject()
        {
            // Snippet: DeleteLogMetricAsync(DeleteLogMetricRequest,CallSettings)
            // Create client
            MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();

            // Initialize request argument(s)
            DeleteLogMetricRequest request = new DeleteLogMetricRequest
            {
                MetricNameAsMetricNameOneof = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]")),
            };
            // Make the request
            await metricsServiceV2Client.DeleteLogMetricAsync(request);

            // End snippet
        }
示例#10
0
        /// <summary>Snippet for GetLogMetricAsync</summary>
        public async Task GetLogMetricAsync_RequestObject()
        {
            // Snippet: GetLogMetricAsync(GetLogMetricRequest,CallSettings)
            // Additional: GetLogMetricAsync(GetLogMetricRequest,CancellationToken)
            // Create client
            MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();

            // Initialize request argument(s)
            GetLogMetricRequest request = new GetLogMetricRequest
            {
                MetricNameAsMetricNameOneof = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]")),
            };
            // Make the request
            LogMetric response = await metricsServiceV2Client.GetLogMetricAsync(request);

            // End snippet
        }
        public void GetLogMetric2()
        {
            Mock <MetricsServiceV2.MetricsServiceV2Client> mockGrpcClient = new Mock <MetricsServiceV2.MetricsServiceV2Client>(MockBehavior.Strict);
            GetLogMetricRequest request = new GetLogMetricRequest
            {
                MetricNameAsMetricNameOneof = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]")),
            };
            LogMetric expectedResponse = new LogMetric
            {
                Name           = "name3373707",
                Description    = "description-1724546052",
                Filter         = "filter-1274492040",
                ValueExtractor = "valueExtractor2047672534",
            };

            mockGrpcClient.Setup(x => x.GetLogMetric(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            MetricsServiceV2Client client = new MetricsServiceV2ClientImpl(mockGrpcClient.Object, null);
            LogMetric response            = client.GetLogMetric(request);

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