File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
src/Dahomey.Cbor.Tests/Issues Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ using Xunit ;
2+
3+ namespace Dahomey . Cbor . Tests . Issues
4+ {
5+ public class Issue0035
6+ {
7+ public class Result < T >
8+ {
9+ public T Data { get ; set ; }
10+
11+ public Result ( T data )
12+ {
13+ Data = data ;
14+ }
15+ }
16+
17+ [ Fact ]
18+ void TestRead ( )
19+ {
20+ const string hexBuffer = "A164446174616474657374" ;
21+ Result < string > result = Helper . Read < Result < string > > ( hexBuffer ) ;
22+
23+ Assert . NotNull ( result ) ;
24+ Assert . Equal ( "test" , result . Data ) ;
25+ }
26+
27+ [ Fact ]
28+ void TestWrite ( )
29+ {
30+ Result < string > result = new Result < string > ( "test" ) ;
31+ string hexEncoded = null ;
32+ var ex = Record . Exception ( ( ) =>
33+ {
34+ hexEncoded = Helper . Write ( result ) ;
35+ } ) ;
36+ Assert . Null ( ex ) ;
37+ Assert . NotNull ( hexEncoded ) ;
38+ Assert . Equal ( "A164446174616474657374" , hexEncoded ) ;
39+ }
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments