Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 9982892

Browse files
committed
Move drop tables code to DropTables method
1 parent 80129a1 commit 9982892

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

src/ServiceStack.OrmLite.PostgreSQL.Tests/ForeignKeyAttributeTests.cs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ public ForeignKeyAttributeTests() : base(Dialect.PostgreSql) { }
1111

1212
[TestFixtureSetUp]
1313
public void Setup()
14+
{
15+
DropTables();
16+
17+
using (var dbConn = OpenDbConnection())
18+
{
19+
dbConn.CreateTable<ReferencedType>(true);
20+
}
21+
}
22+
23+
[TestFixtureTearDown]
24+
public void TearDown()
25+
{
26+
DropTables();
27+
}
28+
29+
private void DropTables()
1430
{
1531
using (var dbConn = OpenDbConnection())
1632
{
@@ -22,8 +38,6 @@ public void Setup()
2238
dbConn.DropTable<TypeWithOnDeleteCascade>();
2339
dbConn.DropTable<TypeWithSimpleForeignKey>();
2440
dbConn.DropTable<ReferencedType>();
25-
26-
dbConn.CreateTable<ReferencedType>(true);
2741
}
2842
}
2943

@@ -109,22 +123,6 @@ public void CanCreateForeignWithOnDeleteSetNull()
109123
dbConn.CreateTable<TypeWithOnDeleteSetNull>(true);
110124
}
111125
}
112-
113-
[TestFixtureTearDown]
114-
public void TearDown()
115-
{
116-
using (var dbConn = OpenDbConnection())
117-
{
118-
dbConn.DropTable<TypeWithOnDeleteAndUpdateCascade>();
119-
dbConn.DropTable<TypeWithOnDeleteSetNull>();
120-
dbConn.DropTable<TypeWithOnDeleteSetDefault>();
121-
dbConn.DropTable<TypeWithOnDeleteRestrict>();
122-
dbConn.DropTable<TypeWithOnDeleteNoAction>();
123-
dbConn.DropTable<TypeWithOnDeleteCascade>();
124-
dbConn.DropTable<TypeWithSimpleForeignKey>();
125-
dbConn.DropTable<ReferencedType>();
126-
}
127-
}
128126
}
129127

130128
public class ReferencedType

0 commit comments

Comments
 (0)