public void Deleting_With_Key_Mappings_Condition() { using (_Connection) { // get expected value var expectedCmd = _Connection.CreateCommand(); expectedCmd.CommandText = @"SELECT COUNT(*) FROM People"; int numberOfPeopleBeforeDeletion = Convert.ToInt32(expectedCmd.ExecuteScalar()); if (numberOfPeopleBeforeDeletion == 0) { throw new Exception("No people found"); } // prepare people for deletion (only id needed) IEnumerable <Person> people = new List <Person>() { new Person() { Id = 3 }, new Person() { Id = 4 }, }; DeleteCommand <Person> cmd = new DeleteCommand <Person>(_Connection, "People"); cmd.MapKey("Id", p => p.Id); cmd.Execute(people); // check var checkCmd = _Connection.CreateCommand(); checkCmd.CommandText = @"SELECT COUNT(*) FROM People"; int numberOfPeopleAfterDeletion = Convert.ToInt32(checkCmd.ExecuteScalar()); Assert.AreEqual(numberOfPeopleBeforeDeletion - 2, numberOfPeopleAfterDeletion); } }