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.
53 lines
1.7 KiB
C#
53 lines
1.7 KiB
C#
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
|
|
using System;
|
|
using System.Linq;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Query;
|
|
using Xunit;
|
|
|
|
// ReSharper disable InconsistentNaming
|
|
namespace EFCore.Jet.CustomBaseTests.GearsOfWarModel;
|
|
|
|
public abstract class GearsOfWarFromSqlQueryTestBase<TFixture> : IClassFixture<TFixture>
|
|
where TFixture : GearsOfWarQueryRelationalFixture, new()
|
|
{
|
|
protected GearsOfWarFromSqlQueryTestBase(TFixture fixture)
|
|
{
|
|
Fixture = fixture;
|
|
}
|
|
|
|
protected TFixture Fixture { get; }
|
|
|
|
[ConditionalFact]
|
|
public virtual void From_sql_queryable_simple_columns_out_of_order()
|
|
{
|
|
using var context = CreateContext();
|
|
var actual = context.Set<Weapon>().FromSqlRaw(
|
|
NormalizeDelimitersInRawString(
|
|
"SELECT [Id], [Name], [IsAutomatic], [AmmunitionType], [OwnerFullName], [SynergyWithId] FROM [Weapons] ORDER BY [Name]"))
|
|
.ToArray();
|
|
|
|
Assert.Equal(10, actual.Length);
|
|
|
|
var first = actual.First();
|
|
|
|
Assert.Equal(AmmunitionType.Shell, first.AmmunitionType);
|
|
Assert.Equal("Baird's Gnasher", first.Name);
|
|
}
|
|
|
|
private string NormalizeDelimitersInRawString(string sql)
|
|
=> Fixture.TestStore.NormalizeDelimitersInRawString(sql);
|
|
|
|
private FormattableString NormalizeDelimitersInInterpolatedString(FormattableString sql)
|
|
=> Fixture.TestStore.NormalizeDelimitersInInterpolatedString(sql);
|
|
|
|
protected GearsOfWarModel.GearsOfWarContext CreateContext()
|
|
=> Fixture.CreateContext();
|
|
|
|
protected virtual void ClearLog()
|
|
{
|
|
}
|
|
}
|