Commit f5855ed
Migrate database tests from SQL Server to SQLite (#4820)
* Migrate database tests from SQL Server LocalDB to SQLite for CI
Replace SQL Server LocalDB dependency with SQLite so database integration
tests can run in CI where no SQL Server instance is available.
Changes:
- Add SqliteTestDb.cs to create/manage a temporary SQLite database with
the same schema and seed data as the original LocalDB test database
- Replace Microsoft.Data.SqlClient with Microsoft.Data.Sqlite package
- Simplify WellKnownValues.cs to serve the SQLite connection string
- Initialize/cleanup SQLite database in AssemblyInitialize/Cleanup
- Remove #if DEBUG guards and [TestCategory("SkipOnCIServer")] attributes
from SafeDataReaderTests, DataPortalTests, and DataPortalExceptionTests
- Update exception message assertions for SQLite CHECK constraint errors
- Remove MDF/LDF file copy references from project file
https://claude.ai/code/session_0123tC2ciU58UgL8jR2d5PBt
* Fix transaction rollback in DataPortal_Insert for SQLite
SQLite's SqliteConnection does not automatically enlist in ambient
System.Transactions.TransactionScope the way SQL Server does. Replace
the [Transactional(TransactionalTypes.TransactionScope)] attribute with
an explicit SQLite transaction so the first INSERT is properly rolled
back when the second INSERT fails the CHECK constraint.
https://claude.ai/code/session_0123tC2ciU58UgL8jR2d5PBt
* Switch to System.Data.SQLite.Core for TransactionScope support
Microsoft.Data.Sqlite does not support System.Transactions.TransactionScope
(EnlistTransaction throws NotSupportedException). Switch to System.Data.SQLite
which properly enlists in ambient TransactionScope, so the
[Transactional(TransactionalTypes.TransactionScope)] attribute test remains
valid and the rollback behavior is tested end-to-end through CSLA.
https://claude.ai/code/session_0123tC2ciU58UgL8jR2d5PBt
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent dd10de5 commit f5855ed
File tree
8 files changed
+177
-247
lines changed- Source/tests/Csla.test
- DPException
- DataPortal
- SafeDataReader
8 files changed
+177
-247
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | 84 | | |
91 | 85 | | |
92 | 86 | | |
| |||
Lines changed: 6 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | 31 | | |
33 | | - | |
34 | 32 | | |
35 | 33 | | |
36 | 34 | | |
| |||
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
46 | | - | |
47 | 44 | | |
48 | 45 | | |
49 | 46 | | |
| |||
54 | 51 | | |
55 | 52 | | |
56 | 53 | | |
57 | | - | |
58 | 54 | | |
59 | 55 | | |
60 | 56 | | |
61 | 57 | | |
62 | 58 | | |
63 | | - | |
64 | | - | |
| 59 | + | |
| 60 | + | |
65 | 61 | | |
66 | 62 | | |
67 | | - | |
68 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
69 | 66 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 67 | + | |
78 | 68 | | |
79 | 69 | | |
80 | 70 | | |
81 | | - | |
82 | 71 | | |
83 | 72 | | |
84 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
43 | | - | |
| 42 | + | |
44 | 43 | | |
45 | 44 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
62 | 50 | | |
63 | 51 | | |
64 | | - | |
65 | 52 | | |
66 | | - | |
67 | 53 | | |
68 | 54 | | |
69 | 55 | | |
| |||
73 | 59 | | |
74 | 60 | | |
75 | 61 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 62 | + | |
89 | 63 | | |
90 | | - | |
| 64 | + | |
91 | 65 | | |
92 | 66 | | |
93 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
94 | 70 | | |
| 71 | + | |
95 | 72 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | 73 | | |
106 | 74 | | |
107 | 75 | | |
| |||
117 | 85 | | |
118 | 86 | | |
119 | 87 | | |
120 | | - | |
121 | | - | |
122 | 88 | | |
123 | 89 | | |
124 | 90 | | |
125 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
126 | 94 | | |
127 | 95 | | |
128 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
129 | 99 | | |
| 100 | + | |
130 | 101 | | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | 102 | | |
141 | 103 | | |
142 | 104 | | |
143 | 105 | | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | 106 | | |
162 | 107 | | |
163 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
123 | | - | |
| 122 | + | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
128 | 130 | | |
129 | 131 | | |
130 | 132 | | |
131 | | - | |
132 | | - | |
| 133 | + | |
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
136 | | - | |
| 137 | + | |
137 | 138 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
144 | 142 | | |
145 | | - | |
146 | 143 | | |
147 | 144 | | |
148 | | - | |
149 | 145 | | |
150 | 146 | | |
151 | 147 | | |
| |||
0 commit comments