-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathDeepObjectMappingTests.cs
57 lines (55 loc) · 1.46 KB
/
DeepObjectMappingTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using NUnit.Framework;
using System.Collections.Generic;
namespace Nest.Tests.Unit.Core.AttributeBasedMap
{
[TestFixture]
public class DeepObjectMappingTests : BaseAttributeMappingTests
{
private class NestedMapParent
{
public string Name { get; set; }
public NestedMapChild Child { get; set; }
}
private class NestedMapChild
{
public string Name { get; set; }
public NestedMapChildChild Child { get; set; }
}
private class NestedMapChildChild
{
public string Name { get; set; }
}
private class NestedRecursiveMapParent
{
public string Name { get; set; }
public NestedRecursiveMapChild Child { get; set; }
}
private class NestedRecursiveMapChild
{
public string Name { get; set; }
public NestedRecursiveMapParent Parent { get; set; }
}
private class RecursiveMapCollection
{
public string Name { get; set; }
public IEnumerable<RecursiveMapCollection> Items { get; set; }
}
[Test]
public void TestDeepObjectWriter()
{
var json = this.CreateMapFor<NestedMapParent>();
this.JsonEquals(json, System.Reflection.MethodInfo.GetCurrentMethod());
}
[Test]
public void TestDeepObjectResursiveWriter()
{
//make sure we dont stackoverflow because of a never ending recursion
Assert.DoesNotThrow(() => this.CreateMapFor<NestedRecursiveMapParent>() );
}
[Test]
public void TestRecursiveCollectionWriter()
{
Assert.DoesNotThrow(() => this.CreateMapFor<RecursiveMapCollection>());
}
}
}