Skip to content

Commit

Permalink
Fix table casing to be the expected default (Pascal casing) (#24819)
Browse files Browse the repository at this point in the history
* Fix table casing to be the expected default (Pascal casing)

* Normalize delimiters in raw SQL queries.
  • Loading branch information
lauxjpn authored Jun 29, 2021
1 parent 872db6e commit 2dd8f76
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.TestUtilities;
using Xunit;

Expand All @@ -18,11 +17,14 @@ protected ConcurrencyDetectorDisabledRelationalTestBase(TFixture fixture)
{
}

protected string NormalizeDelimitersInRawString(string sql)
=> (Fixture.TestStore as RelationalTestStore)?.NormalizeDelimitersInRawString(sql) ?? sql;

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task FromSql(bool async)
=> ConcurrencyDetectorTest(async c => async
? await c.Products.FromSqlRaw("select * from products").ToListAsync()
: c.Products.FromSqlRaw("select * from products").ToList());
? await c.Products.FromSqlRaw(NormalizeDelimitersInRawString("select * from [Products]")).ToListAsync()
: c.Products.FromSqlRaw(NormalizeDelimitersInRawString("select * from [Products]")).ToList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.TestUtilities;
using Xunit;

// ReSharper disable InconsistentNaming
Expand All @@ -16,11 +17,14 @@ protected ConcurrencyDetectorEnabledRelationalTestBase(TFixture fixture)
{
}

protected string NormalizeDelimitersInRawString(string sql)
=> (Fixture.TestStore as RelationalTestStore)?.NormalizeDelimitersInRawString(sql) ?? sql;

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task FromSql(bool async)
=> ConcurrencyDetectorTest(async c => async
? await c.Products.FromSqlRaw("select * from products").ToListAsync()
: c.Products.FromSqlRaw("select * from products").ToList());
? await c.Products.FromSqlRaw(NormalizeDelimitersInRawString("select * from [Products]")).ToListAsync()
: c.Products.FromSqlRaw(NormalizeDelimitersInRawString("select * from [Products]")).ToList());
}
}

0 comments on commit 2dd8f76

Please sign in to comment.