Skip to content

Commit

Permalink
Merge pull request #105 from Readify/issue-14---T
Browse files Browse the repository at this point in the history
Add Transaction, Unwind, Authentication support & CollectAs update
  • Loading branch information
cskardon committed Aug 7, 2015
2 parents d5f0e24 + 555dd63 commit 2d87448
Show file tree
Hide file tree
Showing 184 changed files with 21,847 additions and 16,468 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ Neo4jClient.*.nupkg
*.docstates
*.crunchsolution.cache
packages
*.ncrunch*
*.ncrunchsolution
*.Cache
*.vs\

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
using NUnit.Framework;
using Neo4jClient.ApiModels;

namespace Neo4jClient.Test.ApiModels
{
[TestFixture]
public class RootApiResponseTests
{
[Test]
[TestCase("", Result = "0.0")]
[TestCase("kgrkjkj", Result = "0.0")]
[TestCase("1.5-82-g7cb21bb1-dirty", Result = "1.5", Description = "http://docs.neo4j.org/chunked/snapshot/rest-api-service-root.html")]
[TestCase("1.5M02", Result = "1.5.0.2")]
[TestCase("1.8.RC1", Result = "1.8.0.1")]
[TestCase("1.5.M02", Result = "1.5.0.2", Description = "Retrieved via REST call from running 1.5M02 install")]
[TestCase("1.7", Result = "1.7", Description = "http://docs.neo4j.org/chunked/1.7/rest-api-service-root.html")]
[TestCase("1.7.2", Result = "1.7.2", Description = "http://docs.neo4j.org/chunked/1.7.2/rest-api-service-root.html")]
[TestCase("1.8.M07-1-g09701c5", Result = "1.8.0.7", Description = "http://docs.neo4j.org/chunked/1.8.M07/rest-api-service-root.html")]
[TestCase("1.9.RC1", Result = "1.9.0.1")]
[TestCase("1.9.RC2", Result = "1.9.0.2")]
public string Version(string versionString)
{
var response = new RootApiResponse { neo4j_version = versionString };
return response.Version.ToString();
}
}
}
using NUnit.Framework;
using Neo4jClient.ApiModels;

namespace Neo4jClient.Test.ApiModels
{
[TestFixture]
public class RootApiResponseTests
{
[Test]
[TestCase("", Result = "0.0")]
[TestCase("kgrkjkj", Result = "0.0")]
[TestCase("1.5-82-g7cb21bb1-dirty", Result = "1.5", Description = "http://docs.neo4j.org/chunked/snapshot/rest-api-service-root.html")]
[TestCase("1.5M02", Result = "1.5.0.2")]
[TestCase("1.8.RC1", Result = "1.8.0.1")]
[TestCase("1.5.M02", Result = "1.5.0.2", Description = "Retrieved via REST call from running 1.5M02 install")]
[TestCase("1.7", Result = "1.7", Description = "http://docs.neo4j.org/chunked/1.7/rest-api-service-root.html")]
[TestCase("1.7.2", Result = "1.7.2", Description = "http://docs.neo4j.org/chunked/1.7.2/rest-api-service-root.html")]
[TestCase("1.8.M07-1-g09701c5", Result = "1.8.0.7", Description = "http://docs.neo4j.org/chunked/1.8.M07/rest-api-service-root.html")]
[TestCase("1.9.RC1", Result = "1.9.0.1")]
[TestCase("1.9.RC2", Result = "1.9.0.2")]
public string Version(string versionString)
{
var response = new RootApiResponse { neo4j_version = versionString };
return response.Version.ToString();
}
}
}
122 changes: 61 additions & 61 deletions Test/ApiUsageIdeas.cs → Neo4jClient.Tests/ApiUsageIdeas.cs
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
using System;
using Neo4jClient.Test.Domain;
using Neo4jClient.Test.Relationships;

namespace Neo4jClient.Test
{
// This class just documents how the API could be consumed. It was an
// initial scratching ground before any of the original signatures,
// interfaces, or functionality was put in place. Right now it has no
// other requirements than just compiling (so as to assert backwards
// compatibility with consumers). It is mainly kept for historical
// purposes.
class ApiUsageIdeas
{
void Foo()
{
IGraphClient graph = new GraphClient(new Uri(""));

// Based on http://wiki.neo4j.org/content/Image:Warehouse.png

// Can create nodes from POCOs
var frameStore = graph.Create(
new StorageLocation { Name = "Frame Store" });
var mainStore = graph.Create(
new StorageLocation { Name = "Main Store" });

// Can create a node with outgoing relationships
var frame = graph.Create(
new Part { Name = "Frame" },
new StoredIn(frameStore));

// Can create multiple outgoing relationships and relationships with payloads
graph.Create(
new Product { Name = "Trike", Weight = 2 },
new StoredIn(mainStore),
new Requires(frame, new Requires.Payload { Count = 1 }));

// Can create relationships in both directions
graph.Create(
new Part { Name = "Pedal" },
new StoredIn(frameStore),
new Requires(frame, new Requires.Payload { Count = 2 })
{ Direction = RelationshipDirection.Incoming });

var wheel = graph.Create(
new Part { Name = "Wheel" },
new Requires(frame, new Requires.Payload { Count = 2 })
{ Direction = RelationshipDirection.Incoming });

// Can create implicit incoming relationships
graph.Create(
new StorageLocation { Name = "Wheel Store" },
new StoredIn(wheel));

// Can create relationships against the root node
graph.Create(
new StorageLocation {Name = "Auxillary Store"},
new StoredIn(wheel),
new OwnedBy(graph.RootNode));
}
}
using System;
using Neo4jClient.Test.Domain;
using Neo4jClient.Test.Relationships;

namespace Neo4jClient.Test
{
// This class just documents how the API could be consumed. It was an
// initial scratching ground before any of the original signatures,
// interfaces, or functionality was put in place. Right now it has no
// other requirements than just compiling (so as to assert backwards
// compatibility with consumers). It is mainly kept for historical
// purposes.
class ApiUsageIdeas
{
void Foo()
{
IGraphClient graph = new GraphClient(new Uri(""));

// Based on http://wiki.neo4j.org/content/Image:Warehouse.png

// Can create nodes from POCOs
var frameStore = graph.Create(
new StorageLocation { Name = "Frame Store" });
var mainStore = graph.Create(
new StorageLocation { Name = "Main Store" });

// Can create a node with outgoing relationships
var frame = graph.Create(
new Part { Name = "Frame" },
new StoredIn(frameStore));

// Can create multiple outgoing relationships and relationships with payloads
graph.Create(
new Product { Name = "Trike", Weight = 2 },
new StoredIn(mainStore),
new Requires(frame, new Requires.Payload { Count = 1 }));

// Can create relationships in both directions
graph.Create(
new Part { Name = "Pedal" },
new StoredIn(frameStore),
new Requires(frame, new Requires.Payload { Count = 2 })
{ Direction = RelationshipDirection.Incoming });

var wheel = graph.Create(
new Part { Name = "Wheel" },
new Requires(frame, new Requires.Payload { Count = 2 })
{ Direction = RelationshipDirection.Incoming });

// Can create implicit incoming relationships
graph.Create(
new StorageLocation { Name = "Wheel Store" },
new StoredIn(wheel));

// Can create relationships against the root node
graph.Create(
new StorageLocation {Name = "Auxillary Store"},
new StoredIn(wheel),
new OwnedBy(graph.RootNode));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
using System.Globalization;
using System.Threading;
using NUnit.Framework;

namespace Neo4jClient.Test
{
[SetUpFixture]
public class CultureInfoSetupFixture
{
[SetUp]
public void SetCultureToSomethingNonLatinToEnsureCodeUnderTestDoesntAssumeEnAu()
{
// Issue https://bitbucket.org/Readify/neo4jclient/issue/15/take-cultureinfo-into-account-for-proper

// The idea is to minimize developer mistake by surprising culture-info assumptions. This may not be the best setup for culture-dependent
// tests. The alternative of introducing test base class is deliberately not taken because deriving from it is another assumption by itself.
var thread = Thread.CurrentThread;
thread.CurrentCulture = thread.CurrentUICulture = new CultureInfo("zh-CN");
}
}
}
using System.Globalization;
using System.Threading;
using NUnit.Framework;

namespace Neo4jClient.Test
{
[SetUpFixture]
public class CultureInfoSetupFixture
{
[SetUp]
public void SetCultureToSomethingNonLatinToEnsureCodeUnderTestDoesntAssumeEnAu()
{
// Issue https://bitbucket.org/Readify/neo4jclient/issue/15/take-cultureinfo-into-account-for-proper

// The idea is to minimize developer mistake by surprising culture-info assumptions. This may not be the best setup for culture-dependent
// tests. The alternative of introducing test base class is deliberately not taken because deriving from it is another assumption by itself.
var thread = Thread.CurrentThread;
thread.CurrentCulture = thread.CurrentUICulture = new CultureInfo("zh-CN");
}
}
}
Loading

0 comments on commit 2d87448

Please sign in to comment.