private void Roundtrip <T>(BondSerializer serializer, T value) { var bytes = serializer.ToBinary(value); var deserialized = serializer.FromBinary(bytes, typeof(T)); deserialized.Should().Equals(value); }
public void BondSerializer_must_serialize_small_records_marked_with_Bond_schema_attributes(BondSerializerSettings.ProtocolType protocol) { var settings = BondSerializerSettings.Default.WithProtocol(protocol); var serializer = new BondSerializer((ExtendedActorSystem)Sys, settings); Roundtrip(serializer, new SmallRecord(1, 2)); }
public void BondSerializer_must_serialize_large_records_marked_with_Bond_schema_attributes(BondSerializerSettings.ProtocolType protocol) { var large = new ComposedRecord( firstName: "John", lastName: "Doe", records: new [] { new SmallRecord(1, 2), new SmallRecord(2, 3), new SmallRecord(3, 4), new SmallRecord(4, 5), new SmallRecord(5, 6), }); var settings = BondSerializerSettings.Default.WithProtocol(protocol); var serializer = new BondSerializer((ExtendedActorSystem)Sys, settings); Roundtrip(serializer, large); }