@@ -28,7 +28,7 @@ public class AsyncSerializerTests
2828 [ InlineData ( typeof ( MsgPackCliDefaultAsync < DataItem > ) ) ]
2929 [ InlineData ( typeof ( SystemTextJson < DataItem > ) ) ]
3030#if ( NET6_0_OR_GREATER )
31- [ InlineData ( typeof ( MemoryPack < DataItem > ) ) ]
31+ [ InlineData ( typeof ( MemoryPack < DataItemMemoryPack > ) ) ]
3232 [ InlineData ( typeof ( BinaryPack < DataItem > ) ) ]
3333 [ InlineData ( typeof ( SpanJson < DataItem > ) ) ]
3434 [ InlineData ( typeof ( SystemTextJsonSourceGen < DataItem > ) ) ]
@@ -38,25 +38,15 @@ public class AsyncSerializerTests
3838#endif
3939 public async Task SerializeAsyncTest ( Type serializerType )
4040 {
41- ISerializerTestAsync serializer ;
42- if ( serializerType != typeof ( GoogleProtobuf < ProtobufDataItem > ) )
43- {
44- serializer = ( ISerializerTestAsync ) Activator . CreateInstance ( serializerType ,
45- ( Func < int , DataItem > ) CreateDataExtensions . Data ) ;
46- }
47- else
48- {
49- serializer = ( ISerializerTestAsync ) Activator . CreateInstance ( serializerType ,
50- ( Func < int , ProtobufDataItem > ) CreateDataExtensions . ProtobufData ) ;
51- }
41+ var serializer = serializerType . CreateSerializerInstance ( ) ;
5242
5343 Assert . NotNull ( serializer ) ;
5444 serializer . Setup ( 1 ) ;
5545 var memory = new MemoryStream ( ) ;
5646 await serializer . SerializeAsync ( serializer . TestDataObject , memory ) ;
5747 Assert . NotEqual ( 0 , memory . Length ) ;
5848 }
59-
49+
6050 [ Theory ]
6151 [ InlineData ( typeof ( Ceras < DataItem > ) ) ]
6252 [ InlineData ( typeof ( Utf8JsonSerializer < DataItem > ) ) ]
@@ -77,7 +67,7 @@ public async Task SerializeAsyncTest(Type serializerType)
7767 [ InlineData ( typeof ( MsgPackCliDefaultAsync < DataItem > ) ) ]
7868 [ InlineData ( typeof ( SystemTextJson < DataItem > ) ) ]
7969#if ( NET6_0_OR_GREATER )
80- [ InlineData ( typeof ( MemoryPack < DataItem > ) ) ]
70+ [ InlineData ( typeof ( MemoryPack < DataItemMemoryPack > ) ) ]
8171 [ InlineData ( typeof ( BinaryPack < DataItem > ) ) ]
8272 [ InlineData ( typeof ( SpanJson < DataItem > ) ) ]
8373 [ InlineData ( typeof ( SystemTextJsonSourceGen < DataItem > ) ) ]
@@ -87,17 +77,7 @@ public async Task SerializeAsyncTest(Type serializerType)
8777#endif
8878 public async Task DeserializeAsyncTest ( Type serializerType )
8979 {
90- ISerializerTestAsync serializer ;
91- if ( serializerType != typeof ( GoogleProtobuf < ProtobufDataItem > ) )
92- {
93- serializer = ( ISerializerTestAsync ) Activator . CreateInstance ( serializerType ,
94- ( Func < int , DataItem > ) CreateDataExtensions . Data ) ;
95- }
96- else
97- {
98- serializer = ( ISerializerTestAsync ) Activator . CreateInstance ( serializerType ,
99- ( Func < int , ProtobufDataItem > ) CreateDataExtensions . ProtobufData ) ;
100- }
80+ var serializer = serializerType . CreateSerializerInstance ( ) ;
10181
10282 Assert . NotNull ( serializer ) ;
10383 serializer . Setup ( 1 ) ;
0 commit comments