66using System . Linq . Dynamic . Core . Tests . Helpers . Models ;
77using System . Linq . Expressions ;
88using System . Text ;
9- using Docker . DotNet . Models ;
109using FluentAssertions ;
1110using Xunit ;
1211
@@ -495,6 +494,28 @@ public void Where_Dynamic_NullPropagation_Test2_On_NullableDoubleToString_When_A
495494 result . Should ( ) . ContainInOrder ( 5 , 50 ) ;
496495 }
497496
497+ [ Fact ]
498+ public void Where_Dynamic_ToStringOnGuid ( )
499+ {
500+ // Arrange
501+ const string fieldName = "Id" ;
502+ const string value = "F370C09" ;
503+ var data = new List < DataWithId >
504+ {
505+ new ( Guid . NewGuid ( ) , "bla1" ) ,
506+ new ( Guid . NewGuid ( ) , "bla2" ) ,
507+ new ( Guid . NewGuid ( ) , "bla3" ) ,
508+ new ( Guid . NewGuid ( ) , "bla4" ) ,
509+ new ( new Guid ( "F370C098-8A29-4CF0-9B58-7F3CE258B607" ) , "bla5" )
510+ } . AsQueryable ( ) ;
511+
512+ // Act
513+ var result = data . Where ( fieldName + ".ToString().StartsWith(\" " + value . ToLowerInvariant ( ) + "\" )" ) . ToArray ( ) ;
514+
515+ // Assert
516+ result . Should ( ) . HaveCount ( 1 ) ;
517+ }
518+
498519 [ ExcludeFromCodeCoverage ]
499520 private class PersonWithObject
500521 {
@@ -525,4 +546,7 @@ public class Foo
525546
526547 public DateTime DateTime { get ; set ; }
527548 }
549+
550+ [ ExcludeFromCodeCoverage ]
551+ public record DataWithId ( Guid Id , string Field ) ;
528552}
0 commit comments