-
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 #116 from cskardon/Issue-115
Add ability to set the Planner
- Loading branch information
Showing
18 changed files
with
210 additions
and
74 deletions.
There are no files selected for viewing
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,54 @@ | ||
using System; | ||
using Neo4jClient.Cypher; | ||
using NSubstitute; | ||
using NUnit.Framework; | ||
|
||
namespace Neo4jClient.Test.Cypher | ||
{ | ||
/// <summary> | ||
/// Tests for the UNWIND operator | ||
/// </summary> | ||
[TestFixture] | ||
public class CypherFluentQueryPlannerTests | ||
{ | ||
[Test] | ||
public void TestPlannerWithFreeTextConstruction() | ||
{ | ||
var client = Substitute.For<IRawGraphClient>(); | ||
client.CypherCapabilities.Returns(CypherCapabilities.Cypher22); | ||
|
||
var query = new CypherFluentQuery(client) | ||
.Planner("FreePlanner") | ||
.Query; | ||
|
||
Assert.AreEqual("PLANNER FreePlanner", query.QueryText); | ||
} | ||
|
||
[Test, Sequential] | ||
public void TestPlannerWithCypherPlannerVariant( | ||
[Values(CypherPlanner.CostGreedy,CypherPlanner.CostIdp, CypherPlanner.Rule)] CypherPlanner input, | ||
[Values("COST", "IDP", "RULE")] string expected) | ||
{ | ||
var client = Substitute.For<IRawGraphClient>(); | ||
client.CypherCapabilities.Returns(CypherCapabilities.Cypher22); | ||
|
||
var query = new CypherFluentQuery(client) | ||
.Planner(input) | ||
.Query; | ||
|
||
Assert.AreEqual(string.Format("PLANNER {0}", expected), query.QueryText); | ||
} | ||
|
||
[Test] | ||
[ExpectedException(typeof (InvalidOperationException))] | ||
public void ThrowsInvalidOperationException_WhenNeo4jVersionIsLessThan22() | ||
{ | ||
var client = Substitute.For<IRawGraphClient>(); | ||
client.CypherCapabilities.Returns(CypherCapabilities.Cypher19); | ||
|
||
var _ = new CypherFluentQuery(client) | ||
.Planner("FreePlanner") | ||
.Query; | ||
} | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp50</s:String></wpf:ResourceDictionary> |
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
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.