# .NET NEST Api RhinoMock Aggregation

**URL:** <https://discuss.elastic.co/t/net-nest-api-rhinomock-aggregation/90156>\
**Category:** Elasticsearch\
**Created:** [June 20, 2017, 8:30pm UTC](https://discuss.elastic.co/t/net-nest-api-rhinomock-aggregation/90156 "2017-06-20T20:30:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikram\_prajapati](https://avatars.discourse-cdn.com/v4/letter/v/c37758/32.png) [@vikram\_prajapati](https://discuss.elastic.co/u/vikram_prajapati)\
**Post date:** [June 20, 2017, 8:30pm UTC](https://discuss.elastic.co/t/net-nest-api-rhinomock-aggregation/90156/1 "2017-06-20T20:30:15Z")

</div>

Hello,

I have the following aggregation. How can I mock the data for this on RhinoMock?  
new SearchRequest()  
{  
Size = 0,  
Query = new TermQuery  
{  
Field = Infer.Field(f =\> f.ClientId),  
Value = ClientId  
} && new TermQuery  
{  
Field = Infer.Field(f =\> f.TestGroupId),  
Value = TestGroupId  
} && new TermQuery  
{  
Field = Infer.Field(f =\> f.IsReleaseValidation),  
Value = false  
},  
Aggregations = new TermsAggregation("jobs")  
{  
Field = Infer.Field(f =\> f.RunSourceName.Suffix("keyword")),  
Size = 100,  
Aggregations = new TermsAggregation("runs")  
{  
Field = Infer.Field(f =\> f.RunId),  
Size = 100,  
Aggregations = new TopHitsAggregation("groupby\_runs")  
{  
Size = 100,  
Sort = new List  
{  
new SortField { Field = Infer.Field(f =\> f.TimeStamp), Order = SortOrder.Descending }  
},  
Source = new SourceFilter  
{  
Includes = new[] { Infer.Field(f =\> f.RunId),  
Infer.Field(f =\> f.TimeStamp),  
Infer.Field(f =\> f.RunSourceName),  
Infer.Field(f =\> f.IsPassed),  
Infer.Field(f =\> f.RunSourceDuration),  
Infer.Field(f =\> f.IsReleaseValidation)}  
}  
}  
}  
}  
};

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [June 23, 2017, 6:33am UTC](https://discuss.elastic.co/t/net-nest-api-rhinomock-aggregation/90156/2 "2017-06-23T06:33:41Z")

</div>

Please use the `</>` button to highlight and format your code; it makes it much easier to read 👍

> [@vikram\_prajapati](#):
>
> How can I mock the data for this on RhinoMock?

When you say mock the data, do you mean _stub data returned from the executing this request_?

What have you tried so far?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 21, 2017, 6:33am UTC](https://discuss.elastic.co/t/net-nest-api-rhinomock-aggregation/90156/3 "2017-07-21T06:33:59Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
