public void BasicDescribe() { var ts = new TypeSerializers(); var res = new object[] { "", 1, 1U, (byte)1, (sbyte)1, (short)1, (ushort)1, 1L, 1UL, (double)1, (decimal)1, new DateTime(), new TimeSpan(), Guid.Empty, new byte[0], ByteBuffer.NewEmpty(), false, new EncryptedString() }.Select(o => ts.DescriptorOf(o) !.Describe()); this.Assent(string.Join("\n", res)); }
public void BasicDescribe() { var ts = new TypeSerializers(); var res = new object[] { "", 1, 1U, (byte)1, (sbyte)1, (short)1, (ushort)1, 1L, 1UL, (double)1, (decimal)1, new DateTime(), new TimeSpan(), Guid.Empty, new byte[0], ByteBuffer.NewEmpty(), false }.Select(o => ts.DescriptorOf(o).Describe()); Approvals.VerifyAll(res, "BasicTypes"); }
public void ComplexDescribe() { var ts = new TypeSerializers(); var res = new object[] { new List <int>(), new Dictionary <string, double>(), new SimpleDto(), new ClassWithList(), new ClassWithDict(), new SelfPointing1(), new SelfPointing2(), new TestEnum() }.Select(o => ts.DescriptorOf(o).Describe()); this.Assent(string.Join("\n", res)); }
public void ComplexDescribe() { var ts = new TypeSerializers(); var res = new object[] { new List <int>(), new Dictionary <string, double>(), new SimpleDto(), new ClassWithList(), new ClassWithDict(), new SelfPointing1(), new SelfPointing2(), new TestEnum() }.Select(o => ts.DescriptorOf(o).Describe()); Approvals.VerifyAll(res, "ComplexTypes"); }
dynamic ConvertToDynamicThroughSerialization(object value) { var writer = new SpanWriter(); var storedDescriptorCtx = _mapping.StoreNewDescriptors(value); storedDescriptorCtx.FinishNewDescriptors(ref writer); storedDescriptorCtx.StoreObject(ref writer, value); storedDescriptorCtx.CommitNewDescriptors(); var originalDescription = _ts.DescriptorOf(value).Describe(); var reader = new SpanReader(writer.GetSpan()); var ts = new TypeSerializers(); ts.SetTypeNameMapper(new ToDynamicMapper()); var mapping = ts.CreateMapping(); mapping.LoadTypeDescriptors(ref reader); var obj = (dynamic)mapping.LoadObject(ref reader); Assert.Equal(originalDescription, ts.DescriptorOf((object)obj) !.Describe()); return(obj); }
public EventStoreManager(TypeSerializersOptions?options = null) { _typeSerializers = new TypeSerializers(null, options); CompressionStrategy = new SnappyCompressionStrategy(); }