Github user FlorianHockmann commented on a diff in the pull request:
https://github.com/apache/tinkerpop/pull/842#discussion_r209342928
--- Diff:
gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
---
@@ -346,6 +347,70 @@ public void ShouldSerializeLambda()
"{\"@type\":\"g:Lambda\",\"@value\":{\"script\":\"{
it.get() }\",\"language\":\"gremlin-groovy\",\"arguments\":-1}}";
Assert.Equal(expected, graphSon);
}
+
+ [Fact]
+ public void ShouldSerializeTimeSpan()
+ {
+ var writer = CreateStandardGraphSONWriter();
+ var timeSpan = new TimeSpan(5, 4, 3, 2, 1);
+
+ var graphSon = writer.WriteObject(timeSpan);
+
+ const string expected =
"{\"@type\":\"gx:Duration\",\"@value\":\"P5DT4H3M2.001S\"}";
+ Assert.Equal(expected, graphSon);
+ }
+
+ [Fact]
+ public void ShouldSerializeBigInteger()
+ {
+ var writer = CreateStandardGraphSONWriter();
+ var bigInteger =
BigInteger.Parse("123456789987654321123456789987654321");
+
+ var graphSon = writer.WriteObject(bigInteger);
+
+ const string expected =
"{\"@type\":\"gx:BigInteger\",\"@value\":\"123456789987654321123456789987654321\"}";
+ Assert.Equal(expected, graphSon);
+ }
+
+ [Fact]
+ public void ShouldSerializeByte()
+ {
+ var writer = CreateStandardGraphSONWriter();
+
+ var graphSon = writer.WriteObject((byte)1);
+
+ Assert.Equal("{\"@type\":\"gx:Byte\",\"@value\":1}", graphSon);
+ }
+
+ [Fact]
+ public void ShouldSerializeByteBuffer()
+ {
+ var writer = CreateStandardGraphSONWriter();
+
+ var graphSon =
writer.WriteObject(Convert.FromBase64String("c29tZSBieXRlcyBmb3IgeW91"));
+
+
Assert.Equal("{\"@type\":\"gx:ByteBuffer\",\"@value\":\"c29tZSBieXRlcyBmb3IgeW91\"}",
graphSon);
+ }
+
+ [Fact]
+ public void ShouldSerializeChar()
+ {
+ var writer = CreateStandardGraphSONWriter();
+
+ var graphSon = writer.WriteObject('x');
+
+ Assert.Equal("{\"@type\":\"gx:Char\",\"@value\":\"x\"}",
graphSon);
+ }
+
+ [Fact]
+ public void ShouldSerializeInt16()
+ {
+ var writer = CreateStandardGraphSONWriter();
+
+ var graphSon = writer.WriteObject((short)100);
+
+ Assert.Equal("{\"@type\":\"g:Int16\",\"@value\":100}",
graphSon);
--- End diff --
`short` is also an extended type. So, the type should be `gx:Int16` here.
(You did it right for the deserialization part though.)
---