Skip to content

Commit c3cb75f

Browse files
author
Marc Sallin
committed
#23: Added test for IndexNameCreator.
1 parent 3bda882 commit c3cb75f

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using Microsoft.VisualStudio.TestTools.UnitTesting;
2+
using SQLite.CodeFirst.Builder.NameCreators;
3+
4+
namespace SQLite.CodeFirst.Test.Builder.NameCreators
5+
{
6+
[TestClass]
7+
public class IndexNameCreatorTest
8+
{
9+
[TestMethod]
10+
public void CreateIndexName()
11+
{
12+
string result = IndexNameCreator.CreateIndexName("MyTable", "MyProperty");
13+
Assert.AreEqual("\"IX_MyTable_MyProperty\"", result);
14+
}
15+
16+
[TestMethod]
17+
public void CreateIndexNameEscaped()
18+
{
19+
string result = IndexNameCreator.CreateIndexName("\"base.MyTable\"", "MyProperty");
20+
Assert.AreEqual("\"IX_base.MyTable_MyProperty\"", result);
21+
}
22+
}
23+
}

SQLite.CodeFirst.Test/SQLite.CodeFirst.Test.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
<Compile Include="..\Shared\AssemblySharedInfo.cs">
7777
<Link>Properties\AssemblySharedInfo.cs</Link>
7878
</Compile>
79+
<Compile Include="Builder\NameCreators\IndexNameCreatorTest.cs" />
7980
<Compile Include="Builder\NameCreators\TableNameCreatorTest.cs" />
8081
<Compile Include="Properties\AssemblyInfo.cs" />
8182
<Compile Include="Statement\ColumnConstraint\MaxLengthConstraint.cs" />

0 commit comments

Comments
 (0)