A call to _db.Users.ExistsByName("Foo").ToList(); is valid but a call to _db.Users.ExistsBy(Name: "Foo").ToList(); is not and returns an ArgumentException.
Suggest the following tests should pass.
In Simple.Data.SqlTest, QueryTest.cs
[Test]
public void ExistsByValidValueAsNamedParameterShouldReturnTrue()
{
var db = DatabaseHelper.Open();
Assert.AreEqual(true, db.Users.ExistsBy(Name: "Bob"));
}
[Test]
public void ExistsByInvalidValueAsNamedParameterShouldReturnFalse()
{
var db = DatabaseHelper.Open();
Assert.AreEqual(false, db.Users.ExistsBy(Name: "Peter Kay"));
}
In Simple.Data.InMemoryTest, InMemoryTests.cs
[Test]
public void ExistsByNameAsNamedParameterShouldReturnTrueForExistingData()
{
// Arrange
Database.UseMockAdapter(new InMemoryAdapter());
var db = Database.Open();
db.Users.Insert(Id: 1, Name: "Bob", Age: 30);
// Act
var bobExists = db.Users.ExistsBy(Name : "Bob");
// Assert
Assert.AreEqual(true, bobExists);
}
[Test]
public void ExistsByNameAsNamedParameterShouldReturnFalseForNonExistingData()
{
// Arrange
Database.UseMockAdapter(new InMemoryAdapter());
var db = Database.Open();
db.Users.Insert(Id: 1, Name: "Alice", Age: 30);
// Act
var bobExists = db.Users.ExistsBy(Name: "Bob");
// Assert
Assert.AreEqual(false, bobExists);
}
A call to
_db.Users.ExistsByName("Foo").ToList();
is valid but a call to_db.Users.ExistsBy(Name: "Foo").ToList();
is not and returns an ArgumentException.Suggest the following tests should pass.
In Simple.Data.SqlTest, QueryTest.cs
In Simple.Data.InMemoryTest, InMemoryTests.cs