markrendle / Simple.Data

A light-weight, dynamic data access component for C# 4.0
MIT License
1.33k stars 303 forks source link

Any \ Exists ignores bad \ multiple SimpleExpressions #266

Closed hmobius closed 11 years ago

hmobius commented 11 years ago

A call to Add() or Exists() simply ignores any parameters if they are either

Suggest that the following tests should pass.

[Test]
public void ExistsWithStringParameterThrowsBadExpressionException()
{
   Assert.Throws<BadExpressionException>(() => _db.Users.Exists("Answer").ToList());
}
[Test]
public void ExistsWithColumnNameParameterThrowsBadExpressionException()
{
   Assert.Throws<BadExpressionException>(() => _db.Users.Exists(_db.Users.Id).ToList());
}
[Test]
public void ExistsWithMoreThanOneParameterThrowsArgumentException()
{
   Assert.Throws<ArgumentException>(() => _db.Users.Exists(_db.Users.Id == 1, _db.Users.Id > 0).ToList());
}
markrendle commented 11 years ago

Fixed