33using Moq ;
44using NFluent ;
55using ReClassNET . AddressParser ;
6- using ReClassNET . Extensions ;
76using ReClassNET . Memory ;
7+ using ReClassNET . Util . Conversion ;
88using Xunit ;
99
1010namespace ReClass . NET_Tests . AddressParser
@@ -76,15 +76,20 @@ public void ModuleExpressionTest(string expression, IntPtr expected)
7676 [ MemberData ( nameof ( GetReadMemoryExpressionTestData ) , 4 ) ]
7777 public void ReadMemoryExpression32Test ( string expression , IntPtr expected )
7878 {
79+ var converter = EndianBitConverter . System ;
80+
7981 var mock = new Mock < IProcessReader > ( ) ;
80- mock . Setup ( p => p . ReadRemoteInt32 ( ( IntPtr ) 0 ) )
81- . Returns ( 0 ) ;
82- mock . Setup ( p => p . ReadRemoteInt32 ( ( IntPtr ) 0x10 ) )
83- . Returns ( 0x10 ) ;
84- mock . Setup ( p => p . ReadRemoteInt32 ( ( IntPtr ) 0x20 ) )
85- . Returns ( 0x20 ) ;
86- mock . Setup ( p => p . ReadRemoteInt32 ( ( IntPtr ) 0x30 ) )
87- . Returns ( 0x30 ) ;
82+ mock . SetupProperty ( p => p . BitConverter )
83+ . SetupGet ( p => p . BitConverter )
84+ . Returns ( converter ) ;
85+ mock . Setup ( p => p . ReadRemoteMemory ( ( IntPtr ) 0 , sizeof ( int ) ) )
86+ . Returns ( converter . GetBytes ( 0 ) ) ;
87+ mock . Setup ( p => p . ReadRemoteMemory ( ( IntPtr ) 0x10 , sizeof ( int ) ) )
88+ . Returns ( converter . GetBytes ( 0x10 ) ) ;
89+ mock . Setup ( p => p . ReadRemoteMemory ( ( IntPtr ) 0x20 , sizeof ( int ) ) )
90+ . Returns ( converter . GetBytes ( 0x20 ) ) ;
91+ mock . Setup ( p => p . ReadRemoteMemory ( ( IntPtr ) 0x30 , sizeof ( int ) ) )
92+ . Returns ( converter . GetBytes ( 0x30 ) ) ;
8893
8994 var executor = CreateExecutor ( ) ;
9095
@@ -95,15 +100,20 @@ public void ReadMemoryExpression32Test(string expression, IntPtr expected)
95100 [ MemberData ( nameof ( GetReadMemoryExpressionTestData ) , 8 ) ]
96101 public void ReadMemoryExpression64Test ( string expression , IntPtr expected )
97102 {
103+ var converter = EndianBitConverter . System ;
104+
98105 var mock = new Mock < IProcessReader > ( ) ;
99- mock . Setup ( p => p . ReadRemoteInt64 ( ( IntPtr ) 0 ) )
100- . Returns ( 0 ) ;
101- mock . Setup ( p => p . ReadRemoteInt64 ( ( IntPtr ) 0x10 ) )
102- . Returns ( 0x10 ) ;
103- mock . Setup ( p => p . ReadRemoteInt64 ( ( IntPtr ) 0x20 ) )
104- . Returns ( 0x20 ) ;
105- mock . Setup ( p => p . ReadRemoteInt64 ( ( IntPtr ) 0x30 ) )
106- . Returns ( 0x30 ) ;
106+ mock . SetupProperty ( p => p . BitConverter )
107+ . SetupGet ( p => p . BitConverter )
108+ . Returns ( converter ) ;
109+ mock . Setup ( p => p . ReadRemoteMemory ( ( IntPtr ) 0 , sizeof ( long ) ) )
110+ . Returns ( converter . GetBytes ( 0L ) ) ;
111+ mock . Setup ( p => p . ReadRemoteMemory ( ( IntPtr ) 0x10 , sizeof ( long ) ) )
112+ . Returns ( converter . GetBytes ( 0x10L ) ) ;
113+ mock . Setup ( p => p . ReadRemoteMemory ( ( IntPtr ) 0x20 , sizeof ( long ) ) )
114+ . Returns ( converter . GetBytes ( 0x20L ) ) ;
115+ mock . Setup ( p => p . ReadRemoteMemory ( ( IntPtr ) 0x30 , sizeof ( long ) ) )
116+ . Returns ( converter . GetBytes ( 0x30L ) ) ;
107117
108118 var executor = CreateExecutor ( ) ;
109119
@@ -113,11 +123,16 @@ public void ReadMemoryExpression64Test(string expression, IntPtr expected)
113123 [ Fact ]
114124 public void ReadMemoryExpressionInvariantTest ( )
115125 {
126+ var converter = EndianBitConverter . System ;
127+
116128 var mock = new Mock < IProcessReader > ( ) ;
117- mock . Setup ( p => p . ReadRemoteInt32 ( ( IntPtr ) 0x10 ) )
118- . Returns ( 0x10 ) ;
119- mock . Setup ( p => p . ReadRemoteInt64 ( ( IntPtr ) 0x10 ) )
120- . Returns ( 0x10 ) ;
129+ mock . SetupProperty ( p => p . BitConverter )
130+ . SetupGet ( p => p . BitConverter )
131+ . Returns ( converter ) ;
132+ mock . Setup ( p => p . ReadRemoteMemory ( ( IntPtr ) 0x10 , sizeof ( int ) ) )
133+ . Returns ( converter . GetBytes ( 0x10 ) ) ;
134+ mock . Setup ( p => p . ReadRemoteMemory ( ( IntPtr ) 0x10 , sizeof ( long ) ) )
135+ . Returns ( converter . GetBytes ( 0x10L ) ) ;
121136
122137 var executor = CreateExecutor ( ) ;
123138
0 commit comments