Example #1
0
        public void TestSqLiteConnectionAverageWithHints()
        {
            using (var connection = new SQLiteConnection(Database.ConnectionStringSDS))
            {
                // Setup
                var tables = Database.CreateSdsCompleteTables(10, connection);

                // Act
                connection.Average <SdsCompleteTable>(e => e.ColumnInt,
                                                      (object)null,
                                                      hints: "WhatEver");
            }
        }
Example #2
0
        public void TestSqLiteConnectionAverageViaTableNameWithHints()
        {
            using (var connection = new SQLiteConnection(Database.ConnectionStringSDS))
            {
                // Setup
                var tables = Database.CreateSdsCompleteTables(10, connection);

                // Act
                connection.Average(ClassMappedNameCache.Get <SdsCompleteTable>(),
                                   Field.Parse <SdsCompleteTable>(e => e.ColumnInt).First(),
                                   (object)null,
                                   hints: "WhatEver");
            }
        }
Example #3
0
        public void TestSqLiteConnectionAverageWithoutExpression()
        {
            using (var connection = new SQLiteConnection(Database.ConnectionStringSDS))
            {
                // Setup
                var tables = Database.CreateSdsCompleteTables(10, connection);

                // Act
                var result = connection.Average <SdsCompleteTable>(e => e.ColumnInt,
                                                                   (object)null);

                // Assert
                Assert.AreEqual(tables.Average(e => e.ColumnInt), result);
            }
        }
Example #4
0
        public void TestSqLiteConnectionAverageWithExpression()
        {
            using (var connection = new SQLiteConnection(Database.ConnectionStringSDS))
            {
                // Setup
                var tables = Database.CreateSdsCompleteTables(10, connection);

                // Act
                var ids    = new[] { tables.First().Id, tables.Last().Id };
                var result = connection.Average <SdsCompleteTable>(e => e.ColumnInt,
                                                                   e => ids.Contains(e.Id));

                // Assert
                Assert.AreEqual(tables.Where(e => ids.Contains(e.Id)).Average(e => e.ColumnInt), result);
            }
        }
Example #5
0
        public void TestSqLiteConnectionAverageViaTableNameWithoutExpression()
        {
            using (var connection = new SQLiteConnection(Database.ConnectionStringSDS))
            {
                // Setup
                var tables = Database.CreateSdsCompleteTables(10, connection);

                // Act
                var result = connection.Average(ClassMappedNameCache.Get <SdsCompleteTable>(),
                                                Field.Parse <SdsCompleteTable>(e => e.ColumnInt).First(),
                                                (object)null);

                // Assert
                Assert.AreEqual(tables.Average(e => e.ColumnInt), result);
            }
        }
Example #6
0
        public void TestSqLiteConnectionAverageViaTableNameWithExpression()
        {
            using (var connection = new SQLiteConnection(Database.ConnectionStringSDS))
            {
                // Setup
                var tables = Database.CreateSdsCompleteTables(10, connection);

                // Act
                var ids    = new[] { tables.First().Id, tables.Last().Id };
                var result = connection.Average(ClassMappedNameCache.Get <SdsCompleteTable>(),
                                                Field.Parse <SdsCompleteTable>(e => e.ColumnInt).First(),
                                                new QueryField("Id", Operation.In, ids));

                // Assert
                Assert.AreEqual(tables.Where(e => ids.Contains(e.Id)).Average(e => e.ColumnInt), result);
            }
        }