@@ -20,7 +20,7 @@ public partial class MemberCompilerProviderTest
2020 {
2121 private readonly string [ ] dummy = new string [ 10 ] ;
2222
23- private static Func < string , string [ ] , string > GetCompilerForMethod (
23+ private static IMemberCompilerProvider < string > . BoundCompiler GetCompilerForMethod (
2424 IMemberCompilerProvider < string > provider , Type source , string methodName )
2525 {
2626 if ( source . IsGenericTypeDefinition )
@@ -31,23 +31,23 @@ private static Func<string, string[],string> GetCompilerForMethod(
3131 if ( mi . IsGenericMethodDefinition )
3232 mi = mi . MakeGenericMethod ( typeof ( object ) ) ;
3333 var result = provider . GetCompiler ( mi ) ;
34- Assert . IsNotNull ( result ) ;
34+ Assert . IsFalse ( result . IsNull ) ;
3535 return result ;
3636 }
3737
38- private static Func < string , string [ ] , string > GetCompilerForCtor (
38+ private static IMemberCompilerProvider < string > . BoundCompiler GetCompilerForCtor (
3939 IMemberCompilerProvider < string > provider , Type source )
4040 {
4141 if ( source . IsGenericTypeDefinition )
4242 source = source . MakeGenericType ( typeof ( object ) ) ;
4343
4444 var ci = source . GetConstructors ( ) . First ( ) ;
4545 var result = provider . GetCompiler ( ci ) ;
46- Assert . IsNotNull ( result ) ;
46+ Assert . IsFalse ( result . IsNull ) ;
4747 return result ;
4848 }
4949
50- private static Func < string , string [ ] , string > GetCompilerForField (
50+ private static IMemberCompilerProvider < string > . BoundCompiler GetCompilerForField (
5151 IMemberCompilerProvider < string > provider , Type source , string fieldName )
5252 {
5353 if ( source . IsGenericTypeDefinition )
@@ -56,7 +56,7 @@ private static Func<string, string[], string> GetCompilerForField(
5656 var fi = source . GetField ( fieldName ) ;
5757 Assert . IsNotNull ( fi ) ;
5858 var result = provider . GetCompiler ( fi ) ;
59- Assert . IsNotNull ( result ) ;
59+ Assert . IsFalse ( result . IsNull ) ;
6060 return result ;
6161 }
6262
@@ -71,7 +71,7 @@ public void MethodsTest()
7171 foreach ( string s2 in new [ ] { "Generic" , "NonGeneric" } ) {
7272 string method = s1 + s2 + "Method" ;
7373 var d = GetCompilerForMethod ( provider , t , method ) ;
74- Assert . AreEqual ( t . Name + "." + method , d ( null , dummy ) ) ;
74+ Assert . AreEqual ( t . Name + "." + method , d . Invoke ( null , dummy ) ) ;
7575 }
7676 }
7777
@@ -86,7 +86,7 @@ public void PropertiesTest()
8686 foreach ( string s2 in new [ ] { "InstanceProperty" , "StaticProperty" , "Item" } ) {
8787 string method = s1 + s2 ;
8888 var d = GetCompilerForMethod ( provider , t , method ) ;
89- Assert . AreEqual ( t . Name + "." + method , d ( null , dummy ) ) ;
89+ Assert . AreEqual ( t . Name + "." + method , d . Invoke ( null , dummy ) ) ;
9090 }
9191 }
9292
@@ -99,7 +99,7 @@ public void FieldsTest()
9999 foreach ( var t in new [ ] { typeof ( NonGenericTarget ) , typeof ( GenericTarget < > ) } )
100100 foreach ( string s in new [ ] { "InstanceField" , "StaticField" } ) {
101101 var d = GetCompilerForField ( provider , t , s ) ;
102- Assert . AreEqual ( t . Name + "." + s , d ( null , dummy ) ) ;
102+ Assert . AreEqual ( t . Name + "." + s , d . Invoke ( null , dummy ) ) ;
103103 }
104104 }
105105
@@ -110,7 +110,7 @@ public void CtorsTest()
110110 provider . RegisterCompilers ( typeof ( CtorCompiler ) ) ;
111111 foreach ( var t in new [ ] { typeof ( NonGenericTarget ) , typeof ( GenericTarget < > ) } ) {
112112 var d = GetCompilerForCtor ( provider , t ) ;
113- Assert . AreEqual ( t . Name + Reflection . WellKnown . CtorName , d ( null , dummy ) ) ;
113+ Assert . AreEqual ( t . Name + Reflection . WellKnown . CtorName , d . Invoke ( null , dummy ) ) ;
114114 }
115115 }
116116
@@ -128,8 +128,8 @@ public void GenericFindTest()
128128 . MakeGenericMethod ( typeof ( string ) ) ;
129129
130130 var d = provider . GetCompiler ( mi ) ;
131- Assert . IsNotNull ( d ) ;
132- Assert . AreEqual ( "OK" , d ( null , dummy ) ) ;
131+ Assert . IsFalse ( d . IsNull ) ;
132+ Assert . AreEqual ( "OK" , d . Invoke ( null , dummy ) ) ;
133133 }
134134
135135 [ Test ]
@@ -160,7 +160,7 @@ public void ConflictKeepOldTest()
160160 provider . RegisterCompilers ( typeof ( ConflictCompiler1 ) ) ;
161161 provider . RegisterCompilers ( typeof ( ConflictCompiler2 ) , ConflictHandlingMethod . KeepOld ) ;
162162 var d = GetCompilerForMethod ( provider , typeof ( ConflictTarget ) , "ConflictMethod" ) ;
163- Assert . AreEqual ( "Compiler1" , d ( null , dummy ) ) ;
163+ Assert . AreEqual ( "Compiler1" , d . Invoke ( null , dummy ) ) ;
164164 }
165165
166166 [ Test ]
@@ -170,7 +170,7 @@ public void ConflictOverwriteTest()
170170 provider . RegisterCompilers ( typeof ( ConflictCompiler1 ) ) ;
171171 provider . RegisterCompilers ( typeof ( ConflictCompiler2 ) , ConflictHandlingMethod . Overwrite ) ;
172172 var d = GetCompilerForMethod ( provider , typeof ( ConflictTarget ) , "ConflictMethod" ) ;
173- Assert . AreEqual ( "Compiler2" , d ( null , dummy ) ) ;
173+ Assert . AreEqual ( "Compiler2" , d . Invoke ( null , dummy ) ) ;
174174 }
175175
176176 [ Test ]
@@ -189,7 +189,7 @@ public void NonPublicGetterTest()
189189 . GetProperty ( "InternalProperty" , BindingFlags . Instance | BindingFlags . NonPublic ) ;
190190 Assert . IsNotNull ( property ) ;
191191 var result = provider . GetCompiler ( property ) ;
192- Assert . IsNull ( result ) ;
192+ Assert . IsTrue ( result . IsNull ) ;
193193 }
194194
195195 [ Test ]
0 commit comments