22// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33// Website: https://www.blazor.zone or https://argozhang.github.io/
44
5+ using BootstrapBlazor . Socket . Logging ;
56using Microsoft . Extensions . Logging ;
67using System . Buffers ;
78using System . Net ;
@@ -43,6 +44,10 @@ public async Task GetOrCreate_Ok()
4344
4445 await client5 . DisposeAsync ( ) ;
4546 await factory . DisposeAsync ( ) ;
47+
48+ SocketLogging . LogWarning ( "Warning" ) ;
49+ SocketLogging . LogDebug ( "Debug" ) ;
50+ SocketLogging . LogInformation ( "Information" ) ;
4651 }
4752
4853 [ Fact ]
@@ -670,6 +675,15 @@ public async Task TryConvertTo_Ok()
670675 Assert . Equal ( [ 1 , 2 , 3 , 4 , 5 ] , entity . Header ) ;
671676 Assert . Equal ( [ 3 , 4 ] , entity . Body ) ;
672677
678+ // null
679+ Assert . Equal ( ( byte ) 0x0 , entity . Value16 ) ;
680+
681+ // null
682+ Assert . Equal ( ( byte ) 0x0 , entity . Value17 ) ;
683+
684+ // byte
685+ Assert . Equal ( 0x1 , entity . Value15 ) ;
686+
673687 // string
674688 Assert . Equal ( "1" , entity . Value1 ) ;
675689
@@ -1415,6 +1429,15 @@ class MockEntity
14151429 public string ? Value14 { get ; set ; }
14161430
14171431 public string ? Value13 { get ; set ; }
1432+
1433+ [ DataPropertyConverter ( Type = typeof ( byte ) , Offset = 0 , Length = 1 ) ]
1434+ public byte Value15 { get ; set ; }
1435+
1436+ [ DataPropertyConverter ( Type = typeof ( byte ) , ConverterType = typeof ( MockNullConverter ) , Offset = 0 , Length = 1 ) ]
1437+ public byte Value16 { get ; set ; }
1438+
1439+ [ DataPropertyConverter ( Type = typeof ( byte [ ] ) , Offset = 0 , Length = 1 ) ]
1440+ public byte Value17 { get ; set ; }
14181441 }
14191442
14201443 class MockSocketDataConverter : DataConverter < MockEntity >
@@ -1433,6 +1456,14 @@ protected override bool Parse(ReadOnlyMemory<byte> data, MockEntity entity)
14331456 }
14341457 }
14351458
1459+ class MockNullConverter : IDataPropertyConverter
1460+ {
1461+ public object ? Convert ( ReadOnlyMemory < byte > data )
1462+ {
1463+ return null ;
1464+ }
1465+ }
1466+
14361467 class FooConverter ( string name ) : IDataPropertyConverter
14371468 {
14381469 public object ? Convert ( ReadOnlyMemory < byte > data )
0 commit comments