-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathDeleteByQueryRequestUrlTests.cs
78 lines (67 loc) · 1.91 KB
/
DeleteByQueryRequestUrlTests.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Collections.Generic;
using System.Linq;
using Elasticsearch.Net;
using FluentAssertions;
using Nest.Tests.MockData.Domain;
using NUnit.Framework;
namespace Nest.Tests.Unit.ObjectInitializer.DeleteByQuery
{
[TestFixture]
public class DeleteByQueryRequestUrlTests : BaseJsonTests
{
[Test]
public void Untyped_Defaults()
{
var status = this._client.DeleteByQuery(new DeleteByQueryRequest())
.ConnectionStatus;
status.RequestUrl.Should().EndWith("/nest_test_data/_query");
status.RequestMethod.Should().Be("DELETE");
}
[Test]
public void Untyped_Overrides()
{
var status = this._client.DeleteByQuery(new DeleteByQueryRequest
{
Indices = new IndexNameMarker[] { typeof(ElasticsearchProject), "my-other-index"},
Types = new TypeNameMarker[] {"sometype"}
}).ConnectionStatus;
status.RequestUrl.Should().EndWith("/nest_test_data%2Cmy-other-index/sometype/_query");
status.RequestMethod.Should().Be("DELETE");
}
[Test]
public void Untyped_IndexTypeConstructor()
{
var status = this._client.DeleteByQuery(new DeleteByQueryRequest("myindex", "mytype")
{
})
.ConnectionStatus;
status.RequestUrl.Should().EndWith("/myindex/mytype/_query");
status.RequestMethod.Should().Be("DELETE");
}
[Test]
public void Untyped_ConstructorBeatsAllSetting()
{
var status = this._client.DeleteByQuery(new DeleteByQueryRequest("my-other-index")
{
AllIndices = true,
AllTypes = true
})
.ConnectionStatus;
status.RequestUrl.Should().EndWith("/my-other-index/_query");
status.RequestMethod.Should().Be("DELETE");
}
[Test]
public void Untyped_AllIndicesAllTypes()
{
var status = this._client.DeleteByQuery(new DeleteByQueryRequest
{
AllTypes = true,
AllIndices = true
})
.ConnectionStatus;
status.RequestUrl.Should().EndWith("/_all/_query");
status.RequestMethod.Should().Be("DELETE");
}
}
}