public void TestSqLiteConnectionDeleteAllAsyncViaPrimaryKeys() { using (var connection = new SqliteConnection(Database.ConnectionString)) { // Setup var tables = Database.CreateCompleteTables(10, connection); var primaryKeys = ClassExpression.GetEntitiesPropertyValues <CompleteTable, object>(tables, e => e.Id); // Act var result = connection.DeleteAllAsync <CompleteTable>(primaryKeys).Result; // Assert Assert.AreEqual(tables.Count(), result); } }
public void TestMySqlConnectionDeleteAllViaPrimaryKeysBeyondLimits() { // Setup var tables = Database.CreateCompleteTables(5000); var primaryKeys = ClassExpression.GetEntitiesPropertyValues <CompleteTable, object>(tables, e => e.Id); using (var connection = new MySqlConnection(Database.ConnectionString).EnsureOpen()) { // Act var result = connection.DeleteAll <CompleteTable>(primaryKeys); // Assert Assert.AreEqual(tables.Count(), result); } }
public void TestMySqlConnectionDeleteAllAsyncViaTableNameViaPrimaryKeys() { // Setup var tables = Database.CreateCompleteTables(10); var primaryKeys = ClassExpression.GetEntitiesPropertyValues <CompleteTable, object>(tables, e => e.Id); using (var connection = new MySqlConnection(Database.ConnectionString).EnsureOpen()) { // Act var result = connection.DeleteAllAsync(ClassMappedNameCache.Get <CompleteTable>(), primaryKeys).Result; // Assert Assert.AreEqual(tables.Count(), result); } }
public void TestSqLiteConnectionDeleteAllViaTableNameViaPrimaryKeys() { using (var connection = new SqliteConnection(Database.ConnectionStringMDS)) { // Setup var tables = Database.CreateMdsCompleteTables(10, connection); var primaryKeys = ClassExpression.GetEntitiesPropertyValues <MdsCompleteTable, object>(tables, e => e.Id); // Act var result = connection.DeleteAll(ClassMappedNameCache.Get <MdsCompleteTable>(), primaryKeys); // Assert Assert.AreEqual(tables.Count(), result); } }
public void TestClassExpressionGetEntitiesPropertyValuesViaField() { // Setup var entities = GetEntities(10).AsList(); // Act var propertyValues = ClassExpression.GetEntitiesPropertyValues <ClassExpressionTestClass, string>(entities, new Field("Property1")); // Assert Assert.AreEqual(entities.Count(), propertyValues.Count()); for (var i = 0; i < entities.Count(); i++) { var entity = entities.ElementAt(i); Assert.AreEqual(entity.Property1, propertyValues.ElementAt(i)); } }
public void TestSqlConnectionDeleteAllForInheritedViaPrimary() { // Setup var entities = Helper.CreateInheritedIdentityTables(10); using (var connection = new SqlConnection(Database.ConnectionStringForRepoDb)) { // Act connection.InsertAll <InheritedIdentityTable>(entities); // Act var deleteResult = connection.DeleteAll <InheritedIdentityTable>( ClassExpression.GetEntitiesPropertyValues <InheritedIdentityTable, object>(entities, "Id")); // Assert Assert.AreEqual(entities.Count(), deleteResult); Assert.AreEqual(0, connection.CountAll <InheritedIdentityTable>()); } }