public void AverageWithPredicate()
{
MySqlCommand trueCmd = new MySqlCommand("SELECT AVG(Freight) FROM Orders WHERE storeId=3", conn);
Double freight = (Double)trueCmd.ExecuteScalar();
using (testEntities context = new testEntities())
{
string sql = "SELECT VALUE AVG(o.Freight) FROM Orders AS o WHERE o.Store.Id = 3";
ObjectQuery<Double> q = context.CreateQuery<Double>(sql);
foreach (Double r in q)
Assert.AreEqual(Convert.ToInt32(freight), Convert.ToInt32(r));
}
}