Skip to content

Commit 855dfad

Browse files
committed
Updating test case.
1 parent 2d9b1b1 commit 855dfad

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tests/AutoMapper.Extensions.ExpressionMapping.UnitTests/EnumerableDotContainsWorksOnLocalVariables.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,20 @@ public void Issue87()
2323
var mapper = config.CreateMapper();
2424

2525
var items = new string[] { "item1", "item2" };
26-
Expression<Func<SourceDto, bool>> expression1 = o => items.Contains("");
27-
Expression<Func<SourceDto, bool>> expression2 = o => o.Items.Contains("");
26+
Expression<Func<SourceDto, bool>> expression1 = o => items.Contains("item1");
27+
Expression<Func<SourceDto, bool>> expression2 = o => items.Contains("");
28+
Expression<Func<SourceDto, bool>> expression3 = o => o.Items.Contains("item1");
29+
Expression<Func<SourceDto, bool>> expression4 = o => o.Items.Contains("B");
2830

2931
var mapped1 = mapper.MapExpression<Expression<Func<Source, bool>>>(expression1);
3032
var mapped2 = mapper.MapExpression<Expression<Func<Source, bool>>>(expression2);
33+
var mapped3 = mapper.MapExpression<Expression<Func<Source, bool>>>(expression3);
34+
var mapped4 = mapper.MapExpression<Expression<Func<Source, bool>>>(expression4);
3135

32-
Assert.NotNull(mapped1);
33-
Assert.NotNull(mapped2);
36+
Assert.Equal(1, new Source[] { new Source { } }.AsQueryable().Where(mapped1).Count());
37+
Assert.Equal(0, new Source[] { new Source { } }.AsQueryable().Where(mapped2).Count());
38+
Assert.Equal(1, new Source[] { new Source { Items = new List<SubSource> { new SubSource { Name = "item1" } } } }.AsQueryable().Where(mapped3).Count());
39+
Assert.Equal(0, new Source[] { new Source { Items = new List<SubSource> { new SubSource { Name = "" } } } }.AsQueryable().Where(mapped4).Count());
3440
}
3541

3642
public class Source { public ICollection<SubSource> Items { get; set; } }

0 commit comments

Comments
 (0)