-
Notifications
You must be signed in to change notification settings - Fork 145
/
CypherFluentQueryCustomHeaderTests.cs
64 lines (55 loc) · 2.15 KB
/
CypherFluentQueryCustomHeaderTests.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
using System.Collections.Specialized;
using Neo4jClient.Cypher;
using NSubstitute;
using NUnit.Framework;
namespace Neo4jClient.Test.Cypher
{
[TestFixture]
public class CypherFluentQueryCustomHeaderTests
{
[Test]
public void SetsMaxExecutionTimeAndCustomHeader_WhenUsingAReturnTypeQuery()
{
const string headerName = "HeaderName";
const string headerValue = "TestHeaderValue";
var client = Substitute.For<IRawGraphClient>();
var customHeaders = new NameValueCollection {{headerName, headerValue}};
var query = new CypherFluentQuery(client)
.MaxExecutionTime(100)
.CustomHeaders(customHeaders)
.Match("n")
.Return<object>("n")
.Query;
Assert.AreEqual(100, query.MaxExecutionTime);
Assert.AreEqual(customHeaders, query.CustomHeaders);
}
[Test]
public void SetsCustomHeader_WhenUsingAReturnTypeQuery()
{
const string headerName = "HeaderName";
const string headerValue = "TestHeaderValue";
var client = Substitute.For<IRawGraphClient>();
var customHeaders = new NameValueCollection { { headerName, headerValue } };
var query = new CypherFluentQuery(client)
.CustomHeaders(customHeaders)
.Match("n")
.Return<object>("n")
.Query;
Assert.AreEqual(customHeaders, query.CustomHeaders);
}
[Test]
public void SetsCustomHeader_WhenUsingANonReturnTypeQuery()
{
const string headerName = "HeaderName";
const string headerValue = "TestHeaderValue";
var customHeaders = new NameValueCollection { { headerName, headerValue } };
var client = Substitute.For<IRawGraphClient>();
var query = new CypherFluentQuery(client)
.CustomHeaders(customHeaders)
.Match("n")
.Set("n.Value = 'value'")
.Query;
Assert.AreEqual(customHeaders, query.CustomHeaders);
}
}
}