public void TestCreateClassicContext_Version0_5_Compatible() { var context = SerializationContext.CreateClassicContext(); Assert.That(context, Is.Not.Null); Assert.That(context.DefaultDateTimeConversionMethod, Is.EqualTo(DateTimeConversionMethod.UnixEpoc)); Assert.That(context.EnumSerializationOptions.SerializationMethod, Is.EqualTo(EnumSerializationMethod.ByName)); #if !AOT && !UNITY && !SILVERLIGHT Assert.That(context.SerializerOptions.GeneratorOption, Is.EqualTo(SerializationMethodGeneratorOption.Fast)); #endif // !AOT && !UNITY && !SILVERLIGHT Assert.That(context.SerializationMethod, Is.EqualTo(SerializationMethod.Array)); }
/// <summary> /// Creates new <see cref="SerializationContext"/> for generation based testing. /// </summary> /// <param name="method"><see cref="SerializationMethod"/>.</param> /// <param name="compatibilityLevel"><see cref="SerializationCompatibilityLevel"/> for built-in serializers.</param> /// <returns>A new <see cref="SerializationContext"/> for generation based testing.</returns> public static SerializationContext CreateContext(SerializationMethod method, SerializationCompatibilityLevel compatibilityLevel) { var context = SerializationContext.CreateClassicContext(compatibilityLevel); context.SerializationMethod = method; foreach (var entry in _serializers) { context.Serializers.Register(entry.Key, entry.Value, null, null, SerializerRegistrationOptions.None); } #if !AOT context.SerializerOptions.DisableRuntimeCodeGeneration = true; #endif // !AOT return(context); }
public void TestSerialization_ClassicUnixEpoc() { TestSerializationCore(SerializationContext.CreateClassicContext(), DateTimeConversionMethod.UnixEpoc); }
public void TestSerialization_Classic0_9_Native() { TestSerializationCore(SerializationContext.CreateClassicContext(SerializationCompatibilityLevel.Version0_9), DateTimeConversionMethod.Native); }
public void TestSerialization_Classic0_5_UnixEpoc() { TestSerializationCore(SerializationContext.CreateClassicContext(SerializationCompatibilityLevel.Version0_5), DateTimeConversionMethod.UnixEpoc); }