Skip to content

Commit 6ce9a76

Browse files
committed
Add unit test for generic type mapping
1 parent e1f3eb4 commit 6ce9a76

File tree

4 files changed

+314
-257
lines changed

4 files changed

+314
-257
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"generictypes": {
3+
"properties": {
4+
"listField": {
5+
"type": "string"
6+
},
7+
"tupleField": {
8+
"type": "object",
9+
"properties": {
10+
"item1": {
11+
"type": "string"
12+
},
13+
"item2": {
14+
"type": "integer"
15+
}
16+
}
17+
},
18+
"nullableField": {
19+
"type": "integer"
20+
}
21+
}
22+
}
23+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using NUnit.Framework;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Reflection;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace Nest.Tests.Unit.Core.Map.GenericTypes
10+
{
11+
[TestFixture]
12+
public class GenericTypeMappingTests : BaseJsonTests
13+
{
14+
public class GenericTypes
15+
{
16+
public IEnumerable<string> ListField { get; set; }
17+
public Tuple<string, int> TupleField { get; set; }
18+
public Nullable<int> NullableField { get; set; }
19+
}
20+
21+
[Test]
22+
public void GenericTypeMapping()
23+
{
24+
var result = this._client.Map<GenericTypes>(m => m.MapFromAttributes());
25+
this.JsonEquals(result.ConnectionStatus.Request, MethodInfo.GetCurrentMethod());
26+
}
27+
}
28+
29+
}

0 commit comments

Comments
 (0)