1
+ using NUnit . Framework ;
2
+ using ServiceStack . Common . Tests . Models ;
3
+
4
+ namespace ServiceStack . OrmLite . Tests
5
+ {
6
+ public class OrmLiteDropTableWithNamingStrategyTests
7
+ : OrmLiteTestBase
8
+ {
9
+ [ Test ]
10
+ public void Can_drop_TableWithNamigStrategy_table_prefix ( )
11
+ {
12
+ OrmLiteConfig . DialectProvider . NamingStrategy = new PrefixNamingStrategy
13
+ {
14
+ TablePrefix = "tab_" ,
15
+ ColumnPrefix = "col_"
16
+ } ;
17
+
18
+ using ( var db = ConnectionString . OpenDbConnection ( ) )
19
+ {
20
+ db . CreateTable < ModelWithOnlyStringFields > ( true ) ;
21
+
22
+ db . DropTable < ModelWithOnlyStringFields > ( ) ;
23
+
24
+ Assert . False ( db . TableExists ( "tab_ModelWithOnlyStringFields" ) ) ;
25
+ }
26
+
27
+ OrmLiteConfig . DialectProvider . NamingStrategy = new OrmLiteNamingStrategyBase ( ) ;
28
+ }
29
+
30
+ [ Test ]
31
+ public void Can_drop_TableWithNamigStrategy_table_lowered ( )
32
+ {
33
+ OrmLiteConfig . DialectProvider . NamingStrategy = new LowercaseNamingStrategy ( ) ;
34
+
35
+ using ( var db = ConnectionString . OpenDbConnection ( ) )
36
+ {
37
+ db . CreateTable < ModelWithOnlyStringFields > ( true ) ;
38
+
39
+ db . DropTable < ModelWithOnlyStringFields > ( ) ;
40
+
41
+ Assert . False ( db . TableExists ( "modelwithonlystringfields" ) ) ;
42
+ }
43
+
44
+ OrmLiteConfig . DialectProvider . NamingStrategy = new OrmLiteNamingStrategyBase ( ) ;
45
+ }
46
+
47
+
48
+ [ Test ]
49
+ public void Can_drop_TableWithNamigStrategy_table_nameUnderscoreCompound ( )
50
+ {
51
+ OrmLiteConfig . DialectProvider . NamingStrategy = new UnderscoreSeparatedCompoundNamingStrategy ( ) ;
52
+
53
+ using ( var db = ConnectionString . OpenDbConnection ( ) )
54
+ {
55
+ db . CreateTable < ModelWithOnlyStringFields > ( true ) ;
56
+
57
+ db . DropTable < ModelWithOnlyStringFields > ( ) ;
58
+
59
+ Assert . False ( db . TableExists ( "model_with_only_string_fields" ) ) ;
60
+ }
61
+
62
+ OrmLiteConfig . DialectProvider . NamingStrategy = new OrmLiteNamingStrategyBase ( ) ;
63
+ }
64
+ }
65
+ }
0 commit comments