public void TestMySqlConnectionAverageAsyncWithHints() { // Setup var tables = Database.CreateCompleteTables(10); using (var connection = new MySqlConnection(Database.ConnectionString)) { // Act connection.AverageAsync <CompleteTable>(e => e.ColumnInt, (object)null, hints: "WhatEver").Wait(); } }
public void TestMySqlConnectionAverageAsyncViaTableNameWithHints() { // Setup var tables = Database.CreateCompleteTables(10); using (var connection = new MySqlConnection(Database.ConnectionString)) { // Act connection.AverageAsync(ClassMappedNameCache.Get <CompleteTable>(), Field.Parse <CompleteTable>(e => e.ColumnInt).First(), (object)null, hints: "WhatEver").Wait(); } }
public void TestMySqlConnectionAverageAsyncWithoutExpression() { // Setup var tables = Database.CreateCompleteTables(10); using (var connection = new MySqlConnection(Database.ConnectionString)) { // Act var result = connection.AverageAsync <CompleteTable>(e => e.ColumnInt, (object)null).Result; // Assert Assert.AreEqual(tables.Average(e => e.ColumnInt), Convert.ToDouble(result)); } }
public void TestMySqlConnectionAverageAsyncViaTableNameWithoutExpression() { // Setup var tables = Database.CreateCompleteTables(10); using (var connection = new MySqlConnection(Database.ConnectionString)) { // Act var result = connection.AverageAsync(ClassMappedNameCache.Get <CompleteTable>(), Field.Parse <CompleteTable>(e => e.ColumnInt).First(), (object)null).Result; // Assert Assert.AreEqual(tables.Average(e => e.ColumnInt), Convert.ToDouble(result)); } }
public void TestMySqlConnectionAverageAsyncWithExpression() { // Setup var tables = Database.CreateCompleteTables(10); using (var connection = new MySqlConnection(Database.ConnectionString)) { // Act var ids = new[] { tables.First().Id, tables.Last().Id }; var result = connection.AverageAsync <CompleteTable>(e => e.ColumnInt, e => ids.Contains(e.Id)).Result; // Assert Assert.AreEqual(tables.Where(e => ids.Contains(e.Id)).Average(e => e.ColumnInt), Convert.ToDouble(result)); } }
public void TestMySqlConnectionAverageAsyncViaTableNameWithExpression() { // Setup var tables = Database.CreateCompleteTables(10); using (var connection = new MySqlConnection(Database.ConnectionString)) { // Act var ids = new[] { tables.First().Id, tables.Last().Id }; var result = connection.AverageAsync(ClassMappedNameCache.Get <CompleteTable>(), Field.Parse <CompleteTable>(e => e.ColumnInt).First(), new QueryField("Id", Operation.In, ids)).Result; // Assert Assert.AreEqual(tables.Where(e => ids.Contains(e.Id)).Average(e => e.ColumnInt), Convert.ToDouble(result)); } }