You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
4.0 KiB
C#
101 lines
4.0 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Query;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace EntityFramework.Jet.FunctionalTests
|
|
{
|
|
public class CompiledQueryJetTest : CompiledQueryTestBase<NorthwindQueryJetFixture>
|
|
{
|
|
public CompiledQueryJetTest(NorthwindQueryJetFixture fixture, ITestOutputHelper testOutputHelper)
|
|
: base(fixture)
|
|
{
|
|
fixture.TestSqlLoggerFactory.Clear();
|
|
}
|
|
|
|
public override void DbSet_query()
|
|
{
|
|
base.DbSet_query();
|
|
|
|
Assert.Equal(
|
|
@"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
|
|
FROM [Customers] AS [c]
|
|
|
|
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
|
|
FROM [Customers] AS [c]",
|
|
Sql);
|
|
}
|
|
|
|
public override void DbSet_query_first()
|
|
{
|
|
base.DbSet_query_first();
|
|
|
|
Assert.Equal(
|
|
@"SELECT TOP 1 [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
|
|
FROM [Customers] AS [c]
|
|
ORDER BY [c].[CustomerID]",
|
|
Sql);
|
|
}
|
|
|
|
public override void Untyped_context()
|
|
{
|
|
base.Untyped_context();
|
|
|
|
Assert.Equal(
|
|
@"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
|
|
FROM [Customers] AS [c]
|
|
|
|
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
|
|
FROM [Customers] AS [c]",
|
|
Sql);
|
|
}
|
|
|
|
public override void Query_with_array_parameter()
|
|
{
|
|
base.Query_with_array_parameter();
|
|
|
|
Assert.Equal(
|
|
@"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
|
|
FROM [Customers] AS [c]
|
|
|
|
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
|
|
FROM [Customers] AS [c]",
|
|
Sql);
|
|
}
|
|
|
|
public override void Query_with_contains()
|
|
{
|
|
base.Query_with_contains();
|
|
|
|
Assert.Equal(
|
|
@"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
|
|
FROM [Customers] AS [c]
|
|
WHERE [c].[CustomerID] IN ('ALFKI')
|
|
|
|
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
|
|
FROM [Customers] AS [c]
|
|
WHERE [c].[CustomerID] IN ('ANATR')",
|
|
Sql);
|
|
}
|
|
|
|
public override void Query_with_closure()
|
|
{
|
|
base.Query_with_closure();
|
|
|
|
Assert.Equal(
|
|
@"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
|
|
FROM [Customers] AS [c]
|
|
WHERE [c].[CustomerID] = 'ALFKI'
|
|
|
|
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
|
|
FROM [Customers] AS [c]
|
|
WHERE [c].[CustomerID] = 'ALFKI'",
|
|
Sql);
|
|
}
|
|
|
|
private const string FileLineEnding = @"
|
|
";
|
|
|
|
private string Sql => Fixture.TestSqlLoggerFactory.Sql.Replace(Environment.NewLine, FileLineEnding);
|
|
}
|
|
} |