This is an automated email from the ASF dual-hosted git repository. jorgebg pushed a commit to branch TINKERPOP-2111 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/TINKERPOP-2111 by this push: new 9ef8b2f C# Serializer: Use object instead of dynamic 9ef8b2f is described below commit 9ef8b2fe301b9ed2a23ad631482976101fc4218a Author: Jorge Bay Gondra <jorgebaygon...@gmail.com> AuthorDate: Thu Dec 13 15:43:05 2018 +0100 C# Serializer: Use object instead of dynamic --- .../src/Gremlin.Net/Structure/IO/GraphSON/BulkSetSerializer.cs | 8 ++++---- .../Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs | 3 +-- .../Structure/IO/GraphSON/GraphSONReaderTests.cs | 9 +++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/BulkSetSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/BulkSetSerializer.cs index 116de9c..d5ed66b 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/BulkSetSerializer.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/BulkSetSerializer.cs @@ -42,13 +42,13 @@ namespace Gremlin.Net.Structure.IO.GraphSON // so this query will be trouble. we'd need a legit BulkSet implementation here in C#. this current // implementation is here to replicate the previous functionality that existed on the server side in // previous versions. - var result = new List<Tuple<dynamic,int>>(); + var result = new List<Tuple<object,int>>(); for (var i = 0; i < jArray.Count; i += 2) { - result.Add(new Tuple<dynamic,int>(reader.ToObject(jArray[i]), (int) reader.ToObject(jArray[i + 1]))); + result.Add(new Tuple<object,int>(reader.ToObject(jArray[i]), (int) reader.ToObject(jArray[i + 1]))); } - - return result.Select(x => Enumerable.Repeat(x.Item1, x.Item2)).SelectMany<dynamic,dynamic>(x => x).ToList(); + + return result.SelectMany(x => Enumerable.Repeat(x.Item1, x.Item2)).ToList(); } } } \ No newline at end of file diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs index 0381b41..a753e63 100644 --- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs +++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs @@ -41,8 +41,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin new Dictionary<string, IgnoreReason> { // Add here the name of scenarios to ignore and the reason, e.g. - { "g_V_storeXaX_byXoutEXcreatedX_countX_out_out_storeXaX_byXinEXcreatedX_weight_sumX", IgnoreReason.NoReason }, - { "g_V_hasLabelXpersonX_aggregateXxX_byXageX_capXxX_asXyX_selectXyX", IgnoreReason.NoReason } + //{ "g_V_storeXaX_byXoutEXcreatedX_countX_out_out_storeXaX_byXinEXcreatedX_weight_sumX", IgnoreReason.NoReason } }; private static class Keywords 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 d297133..7685b28 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 @@ -470,6 +470,15 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON } [Fact] + public void ShouldDeserializeBulkSetWithGraphSON3() + { + const string json = + "{\"@type\":\"g:List\",\"@value\":[{\"@type\":\"g:Traverser\",\"@value\":{\"bulk\":{\"@type\":\"g:Int64\",\"@value\":1},\"value\":{\"@type\":\"g:BulkSet\",\"@value\":[{\"@type\":\"g:Int64\",\"@value\":1},{\"@type\":\"g:Int64\",\"@value\":2},{\"@type\":\"g:Int64\",\"@value\":0},{\"@type\":\"g:Int64\",\"@value\":3},{\"@type\":\"g:Int64\",\"@value\":2},{\"@type\":\"g:Int64\",\"@value\":1},{\"@type\":\"g:Double\",\"@value\":1.0},{\"@type\":\"g:Int64\",\"@value\":2}]}}}]}"; + var reader = CreateStandardGraphSONReader(3); + var deserializedValue = reader.ToObject(JObject.Parse(json)); + } + + [Fact] public void ShouldDeserializeTraverser() { dynamic d = JObject.Parse("{\"@type\":\"g:Traverser\",\"@value\":1,\"bulk\": {\"type\":\"g:Int64\",\"value\":10}}");