Skip to content

Commit 6a39172

Browse files
authored
add unit test for Where with empty string (#625)
1 parent bc1923e commit 6a39172

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/System.Linq.Dynamic.Core.Tests/QueryableTests.Where.cs

+18
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,24 @@ public void Where_Dynamic_StringQuoted()
179179
Assert.Equal(expected, result2b);
180180
}
181181

182+
[Fact]
183+
public void Where_Dynamic_EmptyString()
184+
{
185+
// Arrange
186+
var testList = User.GenerateSampleModels(2, allowNullableProfiles: true);
187+
var qry = testList.AsQueryable();
188+
189+
// Act
190+
var expected1 = qry.Where(u => u.UserName != string.Empty).ToArray();
191+
var expected2 = qry.Where(u => u.UserName != "").ToArray();
192+
var resultDynamic1 = qry.Where("UserName != @0", string.Empty).ToArray();
193+
var resultDynamic2 = qry.Where("UserName != @0", "").ToArray();
194+
195+
// Assert
196+
resultDynamic1.Should().Contain(expected1);
197+
resultDynamic2.Should().Contain(expected2);
198+
}
199+
182200
[Fact]
183201
public void Where_Dynamic_SelectNewObjects()
184202
{

0 commit comments

Comments
 (0)