public void ShouldSerializeWithCustomSerializerForCommonType() { var customSerializerMock = new Mock <IGraphSONSerializer>(); var customSerializerByType = new Dictionary <Type, IGraphSONSerializer> { { typeof(int), customSerializerMock.Object } }; var writer = new GraphSON2Writer(customSerializerByType); writer.WriteObject(12); customSerializerMock.Verify(m => m.Dictify(It.Is <int>(v => v == 12), It.IsAny <GraphSONWriter>())); }
public void ShouldSerializeWithCustomSerializerForNewType() { var customSerializerByType = new Dictionary <Type, IGraphSONSerializer> { { typeof(TestClass), new TestGraphSONSerializer { TestNamespace = "NS" } } }; var writer = new GraphSON2Writer(customSerializerByType); var testObj = new TestClass { Value = "test" }; var serialized = writer.WriteObject(testObj); Assert.Equal("{\"@type\":\"NS:TestClass\",\"@value\":\"test\"}", serialized); }
public Graphson2GremlinQuerySerializationTest(ITestOutputHelper testOutputHelper) : base( GremlinQuerySource.g.ConfigureEnvironment(_ => _ .UseSerializer(GremlinQuerySerializer.Default .Select(obj => Writer.WriteObject((Bytecode)obj)))), testOutputHelper) { }