-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #149 from albumprinter/issue-141
issue-141 Adding possibility to add customheaders to a single cypher …
- Loading branch information
Showing
29 changed files
with
595 additions
and
75 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
Neo4jClient.Tests/Cypher/CypherFluentQueryCustomHeaderTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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); | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
Neo4jClient.Tests/Cypher/CypherFluentQueryMaxExecutionTimeTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using NSubstitute; | ||
using NUnit.Framework; | ||
using Neo4jClient.Cypher; | ||
|
||
namespace Neo4jClient.Test.Cypher | ||
{ | ||
[TestFixture] | ||
public class CypherFluentQueryMaxExecutionTimeTests | ||
{ | ||
[Test] | ||
public void SetsMaxExecutionTime_WhenUsingAReturnTypeQuery() | ||
{ | ||
var client = Substitute.For<IRawGraphClient>(); | ||
var query = new CypherFluentQuery(client) | ||
.MaxExecutionTime(100) | ||
.Match("n") | ||
.Return<object>("n") | ||
.Query; | ||
|
||
Assert.AreEqual(100, query.MaxExecutionTime); | ||
} | ||
|
||
[Test] | ||
public void SetsMaxExecutionTime_WhenUsingANonReturnTypeQuery() | ||
{ | ||
var client = Substitute.For<IRawGraphClient>(); | ||
var query = new CypherFluentQuery(client) | ||
.MaxExecutionTime(100) | ||
.Match("n") | ||
.Set("n.Value = 'value'") | ||
.Query; | ||
|
||
Assert.AreEqual(100, query.MaxExecutionTime); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.