-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathGetTemplateResponseSerializationTests.cs
49 lines (41 loc) · 1.28 KB
/
GetTemplateResponseSerializationTests.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
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
using System.Linq;
using Elastic.Clients.Elasticsearch.IndexManagement;
using Tests.Serialization;
namespace Tests.IndexManagement.TemplateManagement;
public class GetTemplateResponseSerializationTests : SerializerTestBase
{
private const string ResponseJson = @"{
""index_templates"": [
{
""name"": ""template_1"",
""index_template"": {
""index_patterns"": [
""te*""
],
""template"": {
""settings"": {
""index"": {
""number_of_shards"": ""2""
}
}
},
""composed_of"": [],
""priority"": 1
}
}
]
}";
[U]
public void GetIndexTemplateResponse_DeserializesCorrectly_WhenIndexPatternsAreIncluded()
{
var response = DeserializeJsonString<GetIndexTemplateResponse>(ResponseJson);
response.IndexTemplates.Should().HaveCount(1);
var template = response.IndexTemplates.First();
template.Name.Should().Be("template_1");
template.IndexTemplate.IndexPatterns.Should().HaveCount(1);
template.IndexTemplate.IndexPatterns.First().Should().Be("te*");
}
}