/// <summary>Snippet for DeleteLogMetric</summary> public void DeleteLogMetric_RequestObject() { // Snippet: DeleteLogMetric(DeleteLogMetricRequest,CallSettings) // Create client MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create(); // Initialize request argument(s) DeleteLogMetricRequest request = new DeleteLogMetricRequest { MetricNameAsMetricNameOneof = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]")), }; // Make the request metricsServiceV2Client.DeleteLogMetric(request); // End snippet }
public void DeleteLogMetricResourceNames() { moq::Mock <MetricsServiceV2.MetricsServiceV2Client> mockGrpcClient = new moq::Mock <MetricsServiceV2.MetricsServiceV2Client>(moq::MockBehavior.Strict); DeleteLogMetricRequest request = new DeleteLogMetricRequest { MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteLogMetric(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); MetricsServiceV2Client client = new MetricsServiceV2ClientImpl(mockGrpcClient.Object, null); client.DeleteLogMetric(request.MetricNameAsLogMetricName); mockGrpcClient.VerifyAll(); }
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(); }
/// <summary>Snippet for DeleteLogMetricAsync</summary> public async Task DeleteLogMetricAsync_RequestObject() { // Snippet: DeleteLogMetricAsync(DeleteLogMetricRequest,CallSettings) // Additional: DeleteLogMetricAsync(DeleteLogMetricRequest,CancellationToken) // 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 }
public async stt::Task DeleteLogMetricResourceNamesAsync() { moq::Mock <MetricsServiceV2.MetricsServiceV2Client> mockGrpcClient = new moq::Mock <MetricsServiceV2.MetricsServiceV2Client>(moq::MockBehavior.Strict); DeleteLogMetricRequest request = new DeleteLogMetricRequest { MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteLogMetricAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null)); MetricsServiceV2Client client = new MetricsServiceV2ClientImpl(mockGrpcClient.Object, null); await client.DeleteLogMetricAsync(request.MetricNameAsLogMetricName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); await client.DeleteLogMetricAsync(request.MetricNameAsLogMetricName, st::CancellationToken.None); mockGrpcClient.VerifyAll(); }