ExistsBy doesn't acknowledge named parameters #268

Closed
hmobius opened this Issue Mar 26, 2013 · 1 comment

Comments

Projects
None yet
2 participants
@hmobius

hmobius commented Mar 26, 2013

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);
}
@markrendle

This comment has been minimized.

Show comment Hide comment
@markrendle

markrendle May 21, 2013

Owner

Fixed.

Owner

markrendle commented May 21, 2013

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment