@@ -35,7 +35,7 @@ public class MyView
3535 public ExpressionParserTests ( )
3636 {
3737 _dynamicTypeProviderMock = new Mock < IDynamicLinkCustomTypeProvider > ( ) ;
38- _dynamicTypeProviderMock . Setup ( dt => dt . GetCustomTypes ( ) ) . Returns ( new HashSet < Type > ( ) { typeof ( Company ) , typeof ( MainCompany ) } ) ;
38+ _dynamicTypeProviderMock . Setup ( dt => dt . GetCustomTypes ( ) ) . Returns ( [ typeof ( Company ) , typeof ( MainCompany ) ] ) ;
3939 _dynamicTypeProviderMock . Setup ( dt => dt . ResolveType ( typeof ( Company ) . FullName ! ) ) . Returns ( typeof ( Company ) ) ;
4040 _dynamicTypeProviderMock . Setup ( dt => dt . ResolveType ( typeof ( MainCompany ) . FullName ! ) ) . Returns ( typeof ( MainCompany ) ) ;
4141 _dynamicTypeProviderMock . Setup ( dt => dt . ResolveTypeBySimpleName ( "Company" ) ) . Returns ( typeof ( Company ) ) ;
@@ -346,7 +346,7 @@ public void Parse_NullableShouldReturnNullable(string expression, object resultT
346346 [ Theory ]
347347 [ InlineData ( "it.MainCompany.Name != null" , "(company.MainCompany.Name != null)" ) ]
348348 [ InlineData ( "@MainCompany.Companies.Count() > 0" , "(company.MainCompany.Companies.Count() > 0)" ) ]
349- // [InlineData("Company.Equals(null, null)", "Equals(null, null)")] issue 867
349+ // [InlineData("Company.Equals(null, null)", "Equals(null, null)")]
350350 [ InlineData ( "MainCompany.Name" , "company.MainCompany.Name" ) ]
351351 [ InlineData ( "Name" , "company.Name" ) ]
352352 [ InlineData ( "company.Name" , "company.Name" ) ]
@@ -377,6 +377,39 @@ public void Parse_When_PrioritizePropertyOrFieldOverTheType_IsTrue(string expres
377377 parsedExpression . Should ( ) . Be ( result ) ;
378378 }
379379
380+ [ Theory ]
381+ [ InlineData ( "object.Equals(null, null)" , "Equals(null, null)" ) ]
382+ [ InlineData ( "Company.Equals(null, null)" , "Equals(null, null)" ) ]
383+ public void Parse_Object_Equals_867_Workaround ( string expression , string result )
384+ {
385+ // Arrange
386+ var config = new ParsingConfig
387+ {
388+ IsCaseSensitive = true ,
389+ CustomTypeProvider = _dynamicTypeProviderMock . Object
390+ } ;
391+ _dynamicTypeProviderMock
392+ . Setup ( dt => dt . GetCustomTypes ( ) )
393+ . Returns ( [ typeof ( Company ) , typeof ( MainCompany ) , typeof ( object ) ] ) ;
394+
395+ ParameterExpression [ ] parameters = [ ParameterExpressionHelper . CreateParameterExpression ( typeof ( Company ) , "company" ) ] ;
396+ var sut = new ExpressionParser ( parameters , expression , null , config ) ;
397+
398+ // Act
399+ string parsedExpression ;
400+ try
401+ {
402+ parsedExpression = sut . Parse ( null ) . ToString ( ) ;
403+ }
404+ catch ( ParseException e )
405+ {
406+ parsedExpression = e . Message ;
407+ }
408+
409+ // Assert
410+ parsedExpression . Should ( ) . Be ( result ) ;
411+ }
412+
380413 [ Theory ]
381414 [ InlineData ( "it.MainCompany.Name != null" , "(company.MainCompany.Name != null)" ) ]
382415 [ InlineData ( "@MainCompany.Companies.Count() > 0" , "(company.MainCompany.Companies.Count() > 0)" ) ]
0 commit comments