Skip to content

Commit 398ecc8

Browse files
committed
Assert Visit method for each type of aggregation
1 parent e029d98 commit 398ecc8

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System.Linq;
2+
using System.Reflection;
3+
using FluentAssertions;
4+
using Nest;
5+
using Nest.Aggregations.Visitor;
6+
using Tests.Framework;
7+
8+
namespace Tests.Aggregations
9+
{
10+
public class AggregationVisitorTests
11+
{
12+
[U]
13+
public void VisitMethodForEachTypeOfAggregation()
14+
{
15+
var aggregationTypes =
16+
from t in typeof(IAggregation).Assembly().Types()
17+
where typeof(IAggregation).IsAssignableFrom(t)
18+
where t.IsInterface()
19+
select t;
20+
21+
var visitorMethodParameters =
22+
from m in typeof(IAggregationVisitor).GetTypeInfo().DeclaredMethods
23+
where m.Name == "Visit"
24+
let aggregationInterface = m.GetParameters().First().ParameterType
25+
where aggregationInterface != typeof(IAggregationContainer)
26+
select aggregationInterface;
27+
28+
visitorMethodParameters.Except(aggregationTypes).Should().BeEmpty();
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)