Repository: tinkerpop
Updated Branches:
  refs/heads/master cb7cdd28c -> fc48b046c


Gremlin .NET Support GraphSON3


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a60e7d3f
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a60e7d3f
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a60e7d3f

Branch: refs/heads/master
Commit: a60e7d3fe64bab26e48640a05f2b914f7443e4bf
Parents: b8d1c04
Author: Jorge Bay Gondra <jorgebaygon...@gmail.com>
Authored: Fri Sep 8 17:32:29 2017 +0200
Committer: Jorge Bay Gondra <jorgebaygon...@gmail.com>
Committed: Wed Sep 20 12:19:23 2017 +0200

----------------------------------------------------------------------
 .../src/Gremlin.Net/Driver/GremlinClient.cs     |   6 +-
 .../Driver/Messages/ResponseResult.cs           |   3 +-
 .../Remote/DriverRemoteTraversalSideEffects.cs  |   2 +-
 .../Structure/IO/GraphSON/GraphSON3Reader.cs    |   3 +-
 .../Structure/IO/GraphSON/Path3Deserializer.cs  |  45 +++++
 .../Structure/IO/GraphSON/PathDeserializer.cs   |   5 +-
 .../src/Gremlin.Net/Structure/Path.cs           |  24 ++-
 .../GraphTraversalTests.cs                      |   4 +-
 .../DriverRemoteConnection/SideEffectTests.cs   |  24 ++-
 .../IO/GraphSON/GraphSONReaderTests.cs          |  22 ++-
 .../Gremlin.Net.UnitTest/Structure/PathTests.cs | 190 +++++++++----------
 11 files changed, 205 insertions(+), 123 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a60e7d3f/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs 
b/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs
index 064770f..a251ab7 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs
@@ -37,7 +37,7 @@ namespace Gremlin.Net.Driver
         /// <summary>
         /// Defines the default mime type to use.
         /// </summary>
-        public const string DefaultMimeType = 
"application/vnd.gremlin-v2.0+json";
+        public const string DefaultMimeType = 
"application/vnd.gremlin-v3.0+json";
         
         private readonly ConnectionPool _connectionPool;
 
@@ -51,8 +51,8 @@ namespace Gremlin.Net.Driver
         public GremlinClient(GremlinServer gremlinServer, GraphSONReader 
graphSONReader = null,
                              GraphSONWriter graphSONWriter = null, string 
mimeType = null)
         {
-            var reader = graphSONReader ?? new GraphSON2Reader();
-            var writer = graphSONWriter ?? new GraphSON2Writer();
+            var reader = graphSONReader ?? new GraphSON3Reader();
+            var writer = graphSONWriter ?? new GraphSON3Writer();
             var connectionFactory = new ConnectionFactory(gremlinServer, 
reader, writer, mimeType ?? DefaultMimeType);
             _connectionPool = new ConnectionPool(connectionFactory);
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a60e7d3f/gremlin-dotnet/src/Gremlin.Net/Driver/Messages/ResponseResult.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Driver/Messages/ResponseResult.cs 
b/gremlin-dotnet/src/Gremlin.Net/Driver/Messages/ResponseResult.cs
index 643fbe8..1fc8f7a 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/Messages/ResponseResult.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/Messages/ResponseResult.cs
@@ -23,13 +23,14 @@
 
 using System.Collections.Generic;
 using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
 
 namespace Gremlin.Net.Driver.Messages
 {
     internal class ResponseResult<T>
     {
         [JsonProperty(PropertyName = "data")]
-        public List<T> Data { get; set; }
+        public JToken Data { get; set; }
 
         [JsonProperty(PropertyName = "meta")]
         public Dictionary<string, object> Meta { get; set; }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a60e7d3f/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteTraversalSideEffects.cs
----------------------------------------------------------------------
diff --git 
a/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteTraversalSideEffects.cs
 
b/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteTraversalSideEffects.cs
index 8f2b3e6..20dd9ee 100644
--- 
a/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteTraversalSideEffects.cs
+++ 
b/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteTraversalSideEffects.cs
@@ -91,7 +91,7 @@ namespace Gremlin.Net.Driver.Remote
 
         private object RetrieveSideEffectsForKey(string key)
         {
-            return 
_gremlinClient.SubmitWithSingleResultAsync<object>(SideEffectGatherMessage(key)).Result;
+            return 
_gremlinClient.SubmitAsync<object>(SideEffectGatherMessage(key)).Result;
         }
 
         private RequestMessage SideEffectGatherMessage(string key)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a60e7d3f/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3Reader.cs
----------------------------------------------------------------------
diff --git 
a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3Reader.cs 
b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3Reader.cs
index 4bc7878..cc74fe3 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3Reader.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3Reader.cs
@@ -35,7 +35,8 @@ namespace Gremlin.Net.Structure.IO.GraphSON
             {
                 { "g:List", new ListSerializer() },
                 { "g:Set", new SetSerializer() },
-                { "g:Map", new MapSerializer() }
+                { "g:Map", new MapSerializer() },
+                { "g:Path", new Path3Deserializer() }
             };
         
         /// <summary>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a60e7d3f/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Path3Deserializer.cs
----------------------------------------------------------------------
diff --git 
a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Path3Deserializer.cs 
b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Path3Deserializer.cs
new file mode 100644
index 0000000..8a0ed5e
--- /dev/null
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Path3Deserializer.cs
@@ -0,0 +1,45 @@
+#region License
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using Newtonsoft.Json.Linq;
+
+namespace Gremlin.Net.Structure.IO.GraphSON
+{
+    internal class Path3Deserializer : IGraphSONDeserializer
+    {
+        public dynamic Objectify(JToken graphsonObject, GraphSONReader reader)
+        {
+            // "labels" is a object[] where each item is ISet<object>
+            var labelProperty = 
(object[])reader.ToObject(graphsonObject["labels"]);
+            var labels = labelProperty
+                .Select(x => new 
HashSet<string>(((ISet<object>)x).Cast<string>()))
+                .ToList<ISet<string>>();
+            // "objects" is an object[]
+            object[] objectsProperty = 
reader.ToObject(graphsonObject["objects"]);
+            var objects = objectsProperty.ToArray();
+            return new Path(labels, objects);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a60e7d3f/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PathDeserializer.cs
----------------------------------------------------------------------
diff --git 
a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PathDeserializer.cs 
b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PathDeserializer.cs
index afdf07c..b322df8 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PathDeserializer.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PathDeserializer.cs
@@ -21,6 +21,7 @@
 
 #endregion
 
+using System.Collections.Generic;
 using System.Linq;
 using Newtonsoft.Json.Linq;
 
@@ -32,8 +33,8 @@ namespace Gremlin.Net.Structure.IO.GraphSON
         {
             var labels =
                 graphsonObject["labels"]
-                    .Select(readObjLabels => readObjLabels.Select(l => 
(string) l).ToList())
-                    .ToList();
+                    .Select(readObjLabels => new 
HashSet<string>(readObjLabels.Select(l => (string) l)))
+                    .ToList<ISet<string>>();
             var objects = graphsonObject["objects"].Select(o => 
reader.ToObject(o)).ToList();
             return new Path(labels, objects);
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a60e7d3f/gremlin-dotnet/src/Gremlin.Net/Structure/Path.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/Path.cs 
b/gremlin-dotnet/src/Gremlin.Net/Structure/Path.cs
index 01a436a..a9f2698 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/Path.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/Path.cs
@@ -43,7 +43,7 @@ namespace Gremlin.Net.Structure
         /// </summary>
         /// <param name="labels">The labels associated with the path</param>
         /// <param name="objects">The objects in the <see cref="Path" 
/>.</param>
-        public Path(List<List<string>> labels, List<object> objects)
+        public Path(IList<ISet<string>> labels, IList<object> objects)
         {
             Labels = labels;
             Objects = objects;
@@ -52,12 +52,12 @@ namespace Gremlin.Net.Structure
         /// <summary>
         ///     Gets an ordered list of the labels associated with the <see 
cref="Path" />.
         /// </summary>
-        public List<List<string>> Labels { get; }
+        public IList<ISet<string>> Labels { get; }
 
         /// <summary>
         ///     Gets an ordered list of the objects in the <see cref="Path" />.
         /// </summary>
-        public List<object> Objects { get; }
+        public IList<object> Objects { get; }
 
         /// <summary>
         ///     Gets the object associated with the particular label of the 
path.
@@ -147,21 +147,31 @@ namespace Gremlin.Net.Structure
             return value != null;
         }
 
-        private bool ObjectsEqual(IReadOnlyCollection<object> otherObjects)
+        private bool ObjectsEqual(ICollection<object> otherObjects)
         {
             if (Objects == null)
                 return otherObjects == null;
             return Objects.SequenceEqual(otherObjects);
         }
 
-        private bool LabelsEqual(IReadOnlyList<List<string>> otherLabels)
+        private bool LabelsEqual(ICollection<ISet<string>> otherLabels)
         {
             if (Labels == null)
                 return otherLabels == null;
             if (Labels.Count != otherLabels.Count)
                 return false;
-            var foundUnequalObjLabels = Labels.Where((objLabels, i) => 
!objLabels.SequenceEqual(otherLabels[i])).Any();
-            return !foundUnequalObjLabels;
+            using (var enumOther = otherLabels.GetEnumerator())
+            using (var enumThis = Labels.GetEnumerator())
+            {
+                while (enumOther.MoveNext() && enumThis.MoveNext())
+                {
+                    if (!enumOther.Current.SequenceEqual(enumThis.Current))
+                    {
+                        return false;
+                    }
+                }
+            }
+            return true;
         }
 
         /// <inheritdoc />

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a60e7d3f/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs
----------------------------------------------------------------------
diff --git 
a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs
 
b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs
index 11190ce..f290894 100644
--- 
a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs
+++ 
b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs
@@ -102,9 +102,9 @@ namespace 
Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
             var connection = _connectionFactory.CreateRemoteConnection();
             var g = graph.Traversal().WithRemote(connection);
 
-            var receivedValueMap = g.V().Has("name", "marko").ValueMap<string, 
object>().Next();
+            var receivedValueMap = g.V().Has("name", "marko").ValueMap<object, 
object>().Next();
 
-            var expectedValueMap = new Dictionary<string, object>
+            var expectedValueMap = new Dictionary<object, object>
             {
                 {"age", new List<object> {29}},
                 {"name", new List<object> {"marko"}}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a60e7d3f/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/SideEffectTests.cs
----------------------------------------------------------------------
diff --git 
a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/SideEffectTests.cs
 
b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/SideEffectTests.cs
index f100e04..ca1c8d5 100644
--- 
a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/SideEffectTests.cs
+++ 
b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/SideEffectTests.cs
@@ -22,9 +22,11 @@
 #endregion
 
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;
+using Gremlin.Net.Process.Traversal;
 using Gremlin.Net.Structure;
 using Xunit;
 
@@ -81,12 +83,20 @@ namespace 
Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
             var g = graph.Traversal().WithRemote(connection);
             var t = g.V().Out("created").GroupCount("m").By("name").Iterate();
             t.SideEffects.Keys();
-
-            var m = t.SideEffects.Get("m") as Dictionary<string, dynamic>;
+            var m = (IList) t.SideEffects.Get("m");
 
             Assert.Equal(2, m.Count);
-            Assert.Equal((long) 3, m["lop"]);
-            Assert.Equal((long) 1, m["ripple"]);
+            var result = new Dictionary<object, object>();
+            
+            foreach (IDictionary map in m)
+            {
+                foreach (var key in map.Keys)
+                {
+                    result.Add(key, map[key]);
+                }
+            }
+            Assert.Equal((long) 3, result["lop"]);
+            Assert.Equal((long) 1, result["ripple"]);
         }
 
         [Fact]
@@ -129,10 +139,8 @@ namespace 
Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
             Assert.Equal(2, keys.Count);
             Assert.Contains("m", keys);
             Assert.Contains("n", keys);
-            var n = (Dictionary<object, long>) t.SideEffects.Get("n");
-            Assert.Equal(2, n.Count);
-            Assert.Equal(3, n["lop"]);
-            Assert.Equal(1, n["ripple"]);
+            var n = (IList<object>) t.SideEffects.Get("n");
+            Assert.Equal(n.Select(tr => ((Traverser)tr).Object), new[] {"lop", 
"ripple"});
         }
 
         [Fact]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a60e7d3f/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
----------------------------------------------------------------------
diff --git 
a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
 
b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
index 3fca7f7..e958e06 100644
--- 
a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
+++ 
b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
@@ -196,12 +196,12 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
             Assert.Equal(new List<object> {5, 6}, deserializedValue);
         }
 
-        [Theory, MemberData(nameof(Versions))]
-        public void ShouldDeserializePath(int version)
+        [Fact]
+        public void ShouldDeserializePathFromGraphSON2()
         {
             var graphSon =
                 
"{\"@type\":\"g:Path\",\"@value\":{\"labels\":[[\"a\"],[\"b\",\"c\"],[]],\"objects\":[{\"@type\":\"g:Vertex\",\"@value\":{\"id\":{\"@type\":\"g:Int32\",\"@value\":1},\"label\":\"person\",\"properties\":{\"name\":[{\"@type\":\"g:VertexProperty\",\"@value\":{\"id\":{\"@type\":\"g:Int64\",\"@value\":0},\"value\":\"marko\",\"label\":\"name\"}}],\"age\":[{\"@type\":\"g:VertexProperty\",\"@value\":{\"id\":{\"@type\":\"g:Int64\",\"@value\":1},\"value\":{\"@type\":\"g:Int32\",\"@value\":29},\"label\":\"age\"}}]}}},{\"@type\":\"g:Vertex\",\"@value\":{\"id\":{\"@type\":\"g:Int32\",\"@value\":3},\"label\":\"software\",\"properties\":{\"name\":[{\"@type\":\"g:VertexProperty\",\"@value\":{\"id\":{\"@type\":\"g:Int64\",\"@value\":4},\"value\":\"lop\",\"label\":\"name\"}}],\"lang\":[{\"@type\":\"g:VertexProperty\",\"@value\":{\"id\":{\"@type\":\"g:Int64\",\"@value\":5},\"value\":\"java\",\"label\":\"lang\"}}]}}},\"lop\"]}}";
-            var reader = CreateStandardGraphSONReader(version);
+            var reader = CreateStandardGraphSONReader(2);
 
             Path readPath = reader.ToObject(JObject.Parse(graphSon));
 
@@ -212,6 +212,22 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
             Assert.Equal(3, readPath.Count);
         }
 
+        [Fact]
+        public void ShouldDeserializePathFromGraphSON3()
+        {
+            var graphSon = "{\"@type\":\"g:Path\",\"@value\":{" +
+                           
"\"labels\":{\"@type\":\"g:List\",\"@value\":[{\"@type\":\"g:Set\",\"@value\":[\"z\"]}]},"
 +
+                           
"\"objects\":{\"@type\":\"g:List\",\"@value\":[{\"@type\":\"g:Vertex\",\"@value\":{\"id\":{\"@type\":\"g:Int64\",\"@value\":5},\"label\":\"\"}}]}}}";
+            var reader = CreateStandardGraphSONReader(3);
+
+            Path readPath = reader.ToObject(JObject.Parse(graphSon));
+
+            Assert.Equal("[v[5]]", readPath.ToString());
+            Assert.Equal(new Vertex(5L), readPath[0]);
+            Assert.Equal(new Vertex(5L), readPath["z"]);
+            Assert.Equal(1, readPath.Count);
+        }
+
         [Theory, MemberData(nameof(Versions))]
         public void ShouldDeserializePropertyWithEdgeElement(int version)
         {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a60e7d3f/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/PathTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/PathTests.cs 
b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/PathTests.cs
index e4ffb6e..cbc3f8d 100644
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/PathTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/PathTests.cs
@@ -34,11 +34,11 @@ namespace Gremlin.Net.UnitTest.Structure
         [Fact]
         public void ShouldAssignPropertiesCorrectly()
         {
-            var labels = new List<List<string>>
+            var labels = new List<ISet<string>>
             {
-                new List<string> {"a", "b"},
-                new List<string> {"c", "b"},
-                new List<string>()
+                new HashSet<string> {"a", "b"},
+                new HashSet<string> {"c", "b"},
+                new HashSet<string>()
             };
             var objects = new List<object> {1, new Vertex(1), "hello"};
 
@@ -51,11 +51,11 @@ namespace Gremlin.Net.UnitTest.Structure
         [Fact]
         public void ShouldReturnTrueForContainsKeyWhenGivenKeyExists()
         {
-            var labels = new List<List<string>>
+            var labels = new List<ISet<string>>
             {
-                new List<string> {"a", "b"},
-                new List<string> {"c", "b"},
-                new List<string>()
+                new HashSet<string> {"a", "b"},
+                new HashSet<string> {"c", "b"},
+                new HashSet<string>()
             };
             var path = new Path(labels, new List<object>());
 
@@ -67,11 +67,11 @@ namespace Gremlin.Net.UnitTest.Structure
         [Fact]
         public void ShouldReturnFalseForContainsKeyWhenGivenKeyDoesNotExist()
         {
-            var labels = new List<List<string>>
+        var labels = new List<ISet<string>>
             {
-                new List<string> {"a", "b"},
-                new List<string> {"c", "b"},
-                new List<string>()
+                new HashSet<string> {"a", "b"},
+                new HashSet<string> {"c", "b"},
+                new HashSet<string>()
             };
             var path = new Path(labels, new List<object>());
 
@@ -84,7 +84,7 @@ namespace Gremlin.Net.UnitTest.Structure
         public void ShouldReturnCountOfObjectsForCountProperty()
         {
             var objects = new List<object> {1, new Vertex(1), "hello"};
-            var path = new Path(new List<List<string>>(), objects);
+            var path = new Path(new List<ISet<string>>(), objects);
 
             var count = path.Count;
 
@@ -95,7 +95,7 @@ namespace Gremlin.Net.UnitTest.Structure
         public void ShouldEnumeratorObjectsIntoListWhenToListIsCalled()
         {
             var objects = new List<object> {1, new Vertex(1), "hello"};
-            var path = new Path(new List<List<string>>(), objects);
+            var path = new Path(new List<ISet<string>>(), objects);
 
             var enumeratedObj = path.ToList();
 
@@ -107,19 +107,19 @@ namespace Gremlin.Net.UnitTest.Structure
         {
             var firstPath =
                 new Path(
-                    new List<List<string>>
+                    new List<ISet<string>>
                     {
-                        new List<string> {"a", "b"},
-                        new List<string> {"c", "b"},
-                        new List<string>()
+                        new HashSet<string> {"a", "b"},
+                        new HashSet<string> {"c", "b"},
+                        new HashSet<string>()
                     }, new List<object> {1, new Vertex(1), "hello"});
             var secondPath =
                 new Path(
-                    new List<List<string>>
+                    new List<ISet<string>>
                     {
-                        new List<string> {"a", "b"},
-                        new List<string> {"c", "b"},
-                        new List<string>()
+                        new HashSet<string> {"a", "b"},
+                        new HashSet<string> {"c", "b"},
+                        new HashSet<string>()
                     }, new List<object> {1, new Vertex(1), "hello"});
 
             var equals = firstPath.Equals(secondPath);
@@ -132,19 +132,19 @@ namespace Gremlin.Net.UnitTest.Structure
         {
             var firstPath =
                 new Path(
-                    new List<List<string>>
+                    new List<ISet<string>>
                     {
-                        new List<string> {"a", "b"},
-                        new List<string> {"c", "b"},
-                        new List<string>()
+                        new HashSet<string> {"a", "b"},
+                        new HashSet<string> {"c", "b"},
+                        new HashSet<string>()
                     }, new List<object> {1, new Vertex(1), "hello"});
             var secondPath =
                 new Path(
-                    new List<List<string>>
+                    new List<ISet<string>>
                     {
-                        new List<string> {"a"},
-                        new List<string> {"c", "b"},
-                        new List<string>()
+                        new HashSet<string> {"a"},
+                        new HashSet<string> {"c", "b"},
+                        new HashSet<string>()
                     }, new List<object> {1, new Vertex(1), "hello"});
 
             var equals = firstPath.Equals(secondPath);
@@ -157,19 +157,19 @@ namespace Gremlin.Net.UnitTest.Structure
         {
             var firstPath =
                 new Path(
-                    new List<List<string>>
+                    new List<ISet<string>>
                     {
-                        new List<string> {"a", "b"},
-                        new List<string> {"c", "b"},
-                        new List<string>()
+                        new HashSet<string> {"a", "b"},
+                        new HashSet<string> {"c", "b"},
+                        new HashSet<string>()
                     }, new List<object> {1, new Vertex(1), "hello"});
             var secondPath =
                 new Path(
-                    new List<List<string>>
+                    new List<ISet<string>>
                     {
-                        new List<string> {"a", "b"},
-                        new List<string> {"c", "b"},
-                        new List<string>()
+                        new HashSet<string> {"a", "b"},
+                        new HashSet<string> {"c", "b"},
+                        new HashSet<string>()
                     }, new List<object> {3, new Vertex(1), "hello"});
 
             var equals = firstPath.Equals(secondPath);
@@ -182,19 +182,19 @@ namespace Gremlin.Net.UnitTest.Structure
         {
             var firstPath =
                 new Path(
-                    new List<List<string>>
+                    new List<ISet<string>>
                     {
-                        new List<string> {"a", "b"},
-                        new List<string> {"c", "b"},
-                        new List<string>()
+                        new HashSet<string> {"a", "b"},
+                        new HashSet<string> {"c", "b"},
+                        new HashSet<string>()
                     }, new List<object> { 1, new Vertex(1), "hello" });
             object secondPath =
                 new Path(
-                    new List<List<string>>
+                    new List<ISet<string>>
                     {
-                        new List<string> {"a", "b"},
-                        new List<string> {"c", "b"},
-                        new List<string>()
+                        new HashSet<string> {"a", "b"},
+                        new HashSet<string> {"c", "b"},
+                        new HashSet<string>()
                     }, new List<object> { 1, new Vertex(1), "hello" });
 
             var equals = firstPath.Equals(secondPath);
@@ -207,19 +207,19 @@ namespace Gremlin.Net.UnitTest.Structure
         {
             var firstPath =
                 new Path(
-                    new List<List<string>>
+                    new List<ISet<string>>
                     {
-                        new List<string> {"a", "b"},
-                        new List<string> {"c", "b"},
-                        new List<string>()
+                        new HashSet<string> {"a", "b"},
+                        new HashSet<string> {"c", "b"},
+                        new HashSet<string>()
                     }, new List<object> { 1, new Vertex(1), "hello" });
             object secondPath =
                 new Path(
-                    new List<List<string>>
+                    new List<ISet<string>>
                     {
-                        new List<string> {"a"},
-                        new List<string> {"c", "b"},
-                        new List<string>()
+                        new HashSet<string> {"a"},
+                        new HashSet<string> {"c", "b"},
+                        new HashSet<string>()
                     }, new List<object> { 1, new Vertex(1), "hello" });
 
             var equals = firstPath.Equals(secondPath);
@@ -232,19 +232,19 @@ namespace Gremlin.Net.UnitTest.Structure
         {
             var firstPath =
                 new Path(
-                    new List<List<string>>
+                    new List<ISet<string>>
                     {
-                        new List<string> {"a", "b"},
-                        new List<string> {"c", "b"},
-                        new List<string>()
+                        new HashSet<string> {"a", "b"},
+                        new HashSet<string> {"c", "b"},
+                        new HashSet<string>()
                     }, new List<object> { 1, new Vertex(1), "hello" });
             object secondPath =
                 new Path(
-                    new List<List<string>>
+                    new List<ISet<string>>
                     {
-                        new List<string> {"a", "b"},
-                        new List<string> {"c", "b"},
-                        new List<string>()
+                        new HashSet<string> {"a", "b"},
+                        new HashSet<string> {"c", "b"},
+                        new HashSet<string>()
                     }, new List<object> { 3, new Vertex(1), "hello" });
 
             var equals = firstPath.Equals(secondPath);
@@ -255,7 +255,7 @@ namespace Gremlin.Net.UnitTest.Structure
         [Fact]
         public void ShouldReturnFalseForEqualsWhereOtherIsNull()
         {
-            var path = new Path(new List<List<string>> {new List<string> {"a", 
"b"},}, new List<object> {1});
+            var path = new Path(new List<ISet<string>> {new HashSet<string> 
{"a", "b"},}, new List<object> {1});
 
             var equals = path.Equals(null);
 
@@ -267,19 +267,19 @@ namespace Gremlin.Net.UnitTest.Structure
         {
             var firstPath =
                 new Path(
-                    new List<List<string>>
+                    new List<ISet<string>>
                     {
-                        new List<string> {"a", "b"},
-                        new List<string> {"c", "b"},
-                        new List<string>()
+                        new HashSet<string> {"a", "b"},
+                        new HashSet<string> {"c", "b"},
+                        new HashSet<string>()
                     }, new List<object> { 1, new Vertex(1), "hello" });
             var secondPath =
                 new Path(
-                    new List<List<string>>
+                    new List<ISet<string>>
                     {
-                        new List<string> {"a", "b"},
-                        new List<string> {"c", "b"},
-                        new List<string>()
+                        new HashSet<string> {"a", "b"},
+                        new HashSet<string> {"c", "b"},
+                        new HashSet<string>()
                     }, new List<object> { 1, new Vertex(1), "hello" });
 
             var firstHashCode = firstPath.GetHashCode();
@@ -292,7 +292,7 @@ namespace Gremlin.Net.UnitTest.Structure
         public void ShouldThrowWhenInvalidIndexIsAccessed()
         {
             var objects = new List<object> {1, new Vertex(1), "hello"};
-            var path = new Path(new List<List<string>>(), objects);
+            var path = new Path(new List<ISet<string>>(), objects);
 
             Assert.Throws<ArgumentOutOfRangeException>(() => path[3]);
         }
@@ -301,7 +301,7 @@ namespace Gremlin.Net.UnitTest.Structure
         public void ShouldReturnObjectsByTheirIndex()
         {
             var objects = new List<object> {1, new Vertex(1), "hello"};
-            var path = new Path(new List<List<string>>(), objects);
+            var path = new Path(new List<ISet<string>>(), objects);
 
             Assert.Equal(1, path[0]);
             Assert.Equal(new Vertex(1), path[1]);
@@ -311,11 +311,11 @@ namespace Gremlin.Net.UnitTest.Structure
         [Fact]
         public void ShouldReturnAllObjectsWhenTheirKeyIsAccessed()
         {
-            var labels = new List<List<string>>
+            var labels = new List<ISet<string>>
             {
-                new List<string> {"a", "b"},
-                new List<string> {"c", "b"},
-                new List<string>()
+                new HashSet<string> {"a", "b"},
+                new HashSet<string> {"c", "b"},
+                new HashSet<string>()
             };
             var objects = new List<object> {1, new Vertex(1), "hello"};
             var path = new Path(labels, objects);
@@ -328,11 +328,11 @@ namespace Gremlin.Net.UnitTest.Structure
         [Fact]
         public void ShouldReturnObjectsByTheirKey()
         {
-            var labels = new List<List<string>>
+            var labels = new List<ISet<string>>
             {
-                new List<string> {"a"},
-                new List<string> {"c", "b"},
-                new List<string>()
+                new HashSet<string> {"a"},
+                new HashSet<string> {"c", "b"},
+                new HashSet<string>()
             };
             var objects = new List<object> {1, new Vertex(1), "hello"};
             var path = new Path(labels, objects);
@@ -345,7 +345,7 @@ namespace Gremlin.Net.UnitTest.Structure
         [Fact]
         public void ShouldThrowWhenUnknownKeyIsAccessed()
         {
-            var path = new Path(new List<List<string>>(), new List<object>());
+            var path = new Path(new List<ISet<string>>(), new List<object>());
 
             Assert.Throws<KeyNotFoundException>(() => path["unknownKey"]);
         }
@@ -353,11 +353,11 @@ namespace Gremlin.Net.UnitTest.Structure
         [Fact]
         public void ShouldReturnCommonStringRepresentationForToString()
         {
-            var labels = new List<List<string>>
+            var labels = new List<ISet<string>>
             {
-                new List<string> {"a", "b"},
-                new List<string> {"c", "b"},
-                new List<string>()
+                new HashSet<string> {"a", "b"},
+                new HashSet<string> {"c", "b"},
+                new HashSet<string>()
             };
             var objects = new List<object> {1, new Vertex(1), "hello"};
             var path = new Path(labels, objects);
@@ -370,11 +370,11 @@ namespace Gremlin.Net.UnitTest.Structure
         [Fact]
         public void 
ShouldReturnTrueAndObjectsForTryGetWhenKeyWithMultipleObjectsIsProvided()
         {
-            var labels = new List<List<string>>
+            var labels = new List<ISet<string>>
             {
-                new List<string> {"a", "b"},
-                new List<string> {"c", "b"},
-                new List<string>()
+                new HashSet<string> {"a", "b"},
+                new HashSet<string> {"c", "b"},
+                new HashSet<string>()
             };
             var objects = new List<object> {1, new Vertex(1), "hello"};
             var path = new Path(labels, objects);
@@ -388,11 +388,11 @@ namespace Gremlin.Net.UnitTest.Structure
         [Fact]
         public void ShouldReturnTrueAndCorrectObjectForTryGet()
         {
-            var labels = new List<List<string>>
+            var labels = new List<ISet<string>>
             {
-                new List<string> {"a"},
-                new List<string> {"c", "b"},
-                new List<string>()
+                new HashSet<string> {"a"},
+                new HashSet<string> {"c", "b"},
+                new HashSet<string>()
             };
             var objects = new List<object> {1, new Vertex(1), "hello"};
             var path = new Path(labels, objects);
@@ -406,7 +406,7 @@ namespace Gremlin.Net.UnitTest.Structure
         [Fact]
         public void ShouldReturnFalseForTryGetWhenUnknownKeyIsProvided()
         {
-            var path = new Path(new List<List<string>>(), new List<object>());
+            var path = new Path(new List<ISet<string>>(), new List<object>());
 
             var success = path.TryGetValue("unknownKey", out object _);
 

Reply via email to