public void TestSqlServerConnectionAverageAll() { // Setup var tables = Database.CreateCompleteTables(10); using (var connection = new SqlConnection(Database.ConnectionString)) { // Act var result = connection.AverageAll <CompleteTable>(e => e.ColumnInt); // Assert Assert.AreEqual(tables.Average(e => e.ColumnInt), Convert.ToDouble(result)); } }
public void TestSqlServerConnectionAverageAllViaTableName() { // Setup var tables = Database.CreateCompleteTables(10); using (var connection = new SqlConnection(Database.ConnectionString)) { // Act var result = connection.AverageAll(ClassMappedNameCache.Get <CompleteTable>(), Field.Parse <CompleteTable>(e => e.ColumnInt).First()); // Assert Assert.AreEqual(tables.Average(e => e.ColumnInt), Convert.ToDouble(result)); } }
public void TestSqlConnectionAverageAllTypedResult() { // Setup var tables = Helper.CreateIdentityTables(10); using (var connection = new SqlConnection(Database.ConnectionStringForRepoDb)) { // Act connection.InsertAll(tables); // Act var result = connection.AverageAll <IdentityTable, double?>(e => e.ColumnInt); // Assert Assert.AreEqual(tables.Average(t => t.ColumnInt), result); } }
public void TestSqlConnectionAverageAllWithHints() { // Setup var tables = Helper.CreateIdentityTables(10); using (var connection = new SqlConnection(Database.ConnectionStringForRepoDb)) { // Act connection.InsertAll(tables); // Act var result = connection.AverageAll <IdentityTable>(e => e.ColumnInt, hints: SqlServerTableHints.NoLock); // Assert Assert.AreEqual(tables.Average(t => t.ColumnInt), Convert.ToDouble(result)); } }
public void TestSqlConnectionAverageAllTypedResultViaTableName() { // Setup var tables = Helper.CreateIdentityTables(10); using (var connection = new SqlConnection(Database.ConnectionStringForRepoDb)) { // Act connection.InsertAll(tables); // Act var result = connection.AverageAll <double?>(ClassMappedNameCache.Get <IdentityTable>(), new Field("ColumnInt")); // Assert Assert.AreEqual(tables.Average(t => t.ColumnInt), result); } }
public void TestSqlConnectionAverageAllViaTableNameWithHints() { // Setup var tables = Helper.CreateIdentityTables(10); using (var connection = new SqlConnection(Database.ConnectionStringForRepoDb)) { // Act connection.InsertAll(tables); // Act var result = connection.AverageAll(ClassMappedNameCache.Get <IdentityTable>(), new Field("ColumnInt"), hints: SqlServerTableHints.NoLock); // Assert Assert.AreEqual(tables.Average(t => t.ColumnInt), Convert.ToDouble(result)); } }