public void RunReport() { Mock <AlphaAnalyticsData.AlphaAnalyticsDataClient> mockGrpcClient = new Mock <AlphaAnalyticsData.AlphaAnalyticsDataClient>(MockBehavior.Strict); RunReportRequest request = new RunReportRequest(); RunReportResponse expectedResponse = new RunReportResponse(); mockGrpcClient.Setup(x => x.RunReport(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); AlphaAnalyticsDataClient client = new AlphaAnalyticsDataClientImpl(mockGrpcClient.Object, null); RunReportResponse response = client.RunReport(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void RunReportRequestObject() { moq::Mock <AlphaAnalyticsData.AlphaAnalyticsDataClient> mockGrpcClient = new moq::Mock <AlphaAnalyticsData.AlphaAnalyticsDataClient>(moq::MockBehavior.Strict); RunReportRequest request = new RunReportRequest { Entity = new Entity(), Dimensions = { new Dimension(), }, Metrics = { new Metric(), }, DateRanges = { new DateRange(), }, Offset = -4389998161825790342L, Limit = 7494001492025909162L, MetricAggregations = { MetricAggregation.Minimum, }, DimensionFilter = new FilterExpression(), MetricFilter = new FilterExpression(), OrderBys = { new OrderBy(), }, CurrencyCode = "currency_code7f81e352", CohortSpec = new CohortSpec(), KeepEmptyRows = true, ReturnPropertyQuota = true, }; RunReportResponse expectedResponse = new RunReportResponse { MetricHeaders = { new MetricHeader(), }, Rows = { new Row(), }, Metadata = new ResponseMetaData(), PropertyQuota = new PropertyQuota(), Totals = { new Row(), }, Maximums = { new Row(), }, Minimums = { new Row(), }, DimensionHeaders = { new DimensionHeader(), }, RowCount = 743251772, }; mockGrpcClient.Setup(x => x.RunReport(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AlphaAnalyticsDataClient client = new AlphaAnalyticsDataClientImpl(mockGrpcClient.Object, null); RunReportResponse response = client.RunReport(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }