public async stt::Task GetUniversalMetadataRequestObjectAsync() { moq::Mock <AlphaAnalyticsData.AlphaAnalyticsDataClient> mockGrpcClient = new moq::Mock <AlphaAnalyticsData.AlphaAnalyticsDataClient>(moq::MockBehavior.Strict); GetUniversalMetadataRequest request = new GetUniversalMetadataRequest { }; UniversalMetadata expectedResponse = new UniversalMetadata { Dimensions = { new DimensionMetadata(), }, Metrics = { new MetricMetadata(), }, }; mockGrpcClient.Setup(x => x.GetUniversalMetadataAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <UniversalMetadata>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AlphaAnalyticsDataClient client = new AlphaAnalyticsDataClientImpl(mockGrpcClient.Object, null); UniversalMetadata responseCallSettings = await client.GetUniversalMetadataAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); UniversalMetadata responseCancellationToken = await client.GetUniversalMetadataAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetUniversalMetadata</summary> public void GetUniversalMetadataRequestObject() { // Snippet: GetUniversalMetadata(GetUniversalMetadataRequest, CallSettings) // Create client AlphaAnalyticsDataClient alphaAnalyticsDataClient = AlphaAnalyticsDataClient.Create(); // Initialize request argument(s) GetUniversalMetadataRequest request = new GetUniversalMetadataRequest { }; // Make the request UniversalMetadata response = alphaAnalyticsDataClient.GetUniversalMetadata(request); // End snippet }
/// <summary>Snippet for GetUniversalMetadataAsync</summary> public async Task GetUniversalMetadataRequestObjectAsync() { // Snippet: GetUniversalMetadataAsync(GetUniversalMetadataRequest, CallSettings) // Additional: GetUniversalMetadataAsync(GetUniversalMetadataRequest, CancellationToken) // Create client AlphaAnalyticsDataClient alphaAnalyticsDataClient = await AlphaAnalyticsDataClient.CreateAsync(); // Initialize request argument(s) GetUniversalMetadataRequest request = new GetUniversalMetadataRequest { }; // Make the request UniversalMetadata response = await alphaAnalyticsDataClient.GetUniversalMetadataAsync(request); // End snippet }
public void GetUniversalMetadataRequestObject() { moq::Mock <AlphaAnalyticsData.AlphaAnalyticsDataClient> mockGrpcClient = new moq::Mock <AlphaAnalyticsData.AlphaAnalyticsDataClient>(moq::MockBehavior.Strict); GetUniversalMetadataRequest request = new GetUniversalMetadataRequest { }; UniversalMetadata expectedResponse = new UniversalMetadata { Dimensions = { new DimensionMetadata(), }, Metrics = { new MetricMetadata(), }, }; mockGrpcClient.Setup(x => x.GetUniversalMetadata(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AlphaAnalyticsDataClient client = new AlphaAnalyticsDataClientImpl(mockGrpcClient.Object, null); UniversalMetadata response = client.GetUniversalMetadata(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }