Skip to content

Commit

Permalink
Merge pull request markrendle#329 from sandranystrom/master
Browse files Browse the repository at this point in the history
Fixed bug when running IN-query on strings with InMemoryAdapter
  • Loading branch information
markrendle committed Mar 31, 2014
2 parents c6deac7 + 042e919 commit fc246cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Simple.Data.InMemoryTest/InMemoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ public void InsertAndFindAllShouldWork()
Assert.AreEqual("Alice", record.Name);
}

[Test]
public void InsertAndFindAllByStringTypeShouldWork()
{
Database.UseMockAdapter(new InMemoryAdapter());
var db = Database.Open();
db.Test.Insert(Id: 1, Name: "Alice");
db.Test.Insert(Id: 2, Name: "Bob");
List<dynamic> records = db.Test.FindAllByName(new[] { "Alice", "Bob" }).ToList();
Assert.IsNotNull(records);
Assert.AreEqual(2, records.Count);
}

[Test]
public void InsertAndFindWithTwoColumnsShouldWork()
{
Expand Down
2 changes: 1 addition & 1 deletion Simple.Data/QueryPolyfills/WhereClauseHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private Func<IDictionary<string, object>, bool> EqualExpressionToWhereClause(Sim
d =>
{
var resolvedLeftOperand = Resolve(d, arg.LeftOperand);
if (resolvedLeftOperand.OfType<IEnumerable>().Any())
if (resolvedLeftOperand.Any(o => !(o is string) && o is IEnumerable))
{
return resolvedLeftOperand.OfType<IEnumerable>().Any(
o => o.Cast<object>().SequenceEqual(((IEnumerable)arg.RightOperand).Cast<object>()));
Expand Down

0 comments on commit fc246cc

Please sign in to comment.