public LengthJsonConverter(
     LengthJsonSerializationFormat serializationFormat         = LengthJsonSerializationFormat.AsMetresWithUnit,
     LinearUnitJsonSerializationFormat unitSerializationFormat = LinearUnitJsonSerializationFormat.PredefinedAsString)
     : base(
         unitConverter: new LengthUnitJsonConverter(unitSerializationFormat),
         serializationFormat: (QuantityJsonSerializationFormat)serializationFormat)
 {
 }
 public LengthSerializeTestData(
     Length value,
     LengthJsonSerializationFormat format,
     LinearUnitJsonSerializationFormat unitFormat,
     string expectedJsonPattern)
     : base(value, unitFormat, expectedJsonPattern)
 {
     Format = format;
 }
        public void SerializeAndDeserializeWithMetres_ShouldBeIdempotent(LengthJsonSerializationFormat format, LinearUnitJsonSerializationFormat unitFormat)
        {
            // arrange
            var length    = Fixture.Create <Length>();
            var converter = new LengthJsonConverter(format, unitFormat);

            // act
            string serializedLength1   = JsonConvert.SerializeObject(length, converter);
            var    deserializedLength1 = JsonConvert.DeserializeObject <Length>(serializedLength1, converter);
            string serializedLength2   = JsonConvert.SerializeObject(deserializedLength1, converter);
            var    deserializedLength2 = JsonConvert.DeserializeObject <Length>(serializedLength2, converter);

            // assert
            deserializedLength1.Should().Be(length);
            deserializedLength2.Should().Be(length);

            deserializedLength2.Should().Be(deserializedLength1);
            serializedLength2.Should().Be(serializedLength1);
        }