mirror of
https://github.com/fergalmoran/EFCore.NamingConventions.git
synced 2025-12-22 09:38:21 +00:00
28 lines
943 B
C#
28 lines
943 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using Xunit;
|
|
|
|
namespace EFCore.NamingConventions.Test
|
|
{
|
|
public class LowerCaseNamingTest : RewriterTestBase
|
|
{
|
|
[Fact]
|
|
public void Table_name_is_rewritten()
|
|
{
|
|
using var context = CreateContext();
|
|
var entityType = context.Model.FindEntityType(typeof(SimpleBlog));
|
|
Assert.Equal("simpleblog", entityType.GetTableName());
|
|
}
|
|
|
|
[Fact]
|
|
public void Column_name_is_rewritten()
|
|
{
|
|
using var context = CreateContext();
|
|
var entityType = context.Model.FindEntityType(typeof(SimpleBlog));
|
|
Assert.Equal("id", entityType.FindProperty("Id").GetColumnName());
|
|
Assert.Equal("fullname", entityType.FindProperty("FullName").GetColumnName());
|
|
}
|
|
|
|
TestContext CreateContext() => new TestContext(NamingConventionsExtensions.UseLowerCaseNamingConvention);
|
|
}
|
|
}
|