Skip to content

Commit e27bfdf

Browse files
committed
#706 added unit test for source serialization (only had integration tests)
1 parent 96e0c4d commit e27bfdf

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"from": 0,
3+
"size": 10,
4+
"_source": {
5+
"include": [
6+
"name",
7+
"nestedFollowers"
8+
],
9+
"exclude": [
10+
"nestedFollowers.dateOfBirth"
11+
]
12+
}
13+
}
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System.Linq;
2+
using System.Reflection;
3+
using NUnit.Framework;
4+
using Nest.Tests.MockData.Domain;
5+
6+
namespace Nest.Tests.Unit.Search.Source
7+
{
8+
[TestFixture]
9+
public class SourceTests : BaseJsonTests
10+
{
11+
[Test]
12+
public void SourceSerializes()
13+
{
14+
var s = new SearchDescriptor<ElasticsearchProject>()
15+
.From(0)
16+
.Size(10)
17+
.Source(source=>source
18+
.Include(p=>p.Name, p=>p.NestedFollowers)
19+
.Exclude(p=>p.NestedFollowers.First().DateOfBirth)
20+
);
21+
this.JsonEquals(s, MethodInfo.GetCurrentMethod());
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)