public void TestPostgreSqlConnectionAverageWithHints() { // Setup var tables = Database.CreateCompleteTables(10); using (var connection = new NpgsqlConnection(Database.ConnectionString)) { // Act connection.Average <CompleteTable>(e => e.ColumnInteger, (object)null, hints: "WhatEver"); } }
public void TestPostgreSqlConnectionAverageViaTableNameWithHints() { // Setup var tables = Database.CreateCompleteTables(10); using (var connection = new NpgsqlConnection(Database.ConnectionString)) { // Act connection.Average(ClassMappedNameCache.Get <CompleteTable>(), Field.Parse <CompleteTable>(e => e.ColumnInteger).First(), (object)null, hints: "WhatEver"); } }
public void TestPostgreSqlConnectionAverageWithoutExpression() { // Setup var tables = Database.CreateCompleteTables(10); using (var connection = new NpgsqlConnection(Database.ConnectionString)) { // Act var result = connection.Average <CompleteTable>(e => e.ColumnInteger, (object)null); // Assert Assert.AreEqual(tables.Average(e => e.ColumnInteger), Convert.ToDouble(result)); } }
public void TestPostgreSqlConnectionAverageWithExpression() { // Setup var tables = Database.CreateCompleteTables(10); using (var connection = new NpgsqlConnection(Database.ConnectionString)) { // Act var ids = new[] { tables.First().Id, tables.Last().Id }; var result = connection.Average <CompleteTable>(e => e.ColumnInteger, e => ids.Contains(e.Id)); // Assert Assert.AreEqual(tables.Where(e => ids.Contains(e.Id)).Average(e => e.ColumnInteger), Convert.ToDouble(result)); } }
public void TestPostgreSqlConnectionAverageViaTableNameWithoutExpression() { // Setup var tables = Database.CreateCompleteTables(10); using (var connection = new NpgsqlConnection(Database.ConnectionString)) { // Act var result = connection.Average(ClassMappedNameCache.Get <CompleteTable>(), Field.Parse <CompleteTable>(e => e.ColumnInteger).First(), (object)null); // Assert Assert.AreEqual(tables.Average(e => e.ColumnInteger), Convert.ToDouble(result)); } }
public void TestPostgreSqlConnectionAverageViaTableNameWithExpression() { // Setup var tables = Database.CreateCompleteTables(10); using (var connection = new NpgsqlConnection(Database.ConnectionString)) { // Act var ids = new[] { tables.First().Id, tables.Last().Id }; var result = connection.Average(ClassMappedNameCache.Get <CompleteTable>(), Field.Parse <CompleteTable>(e => e.ColumnInteger).First(), new QueryField("Id", Operation.In, ids)); // Assert Assert.AreEqual(tables.Where(e => ids.Contains(e.Id)).Average(e => e.ColumnInteger), Convert.ToDouble(result)); } }