Skip to content

Commit 7214d3c

Browse files
committed
Improve test infrastructure.
1 parent a9455f8 commit 7214d3c

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

test/EFCore.Jet.Tests/JetMigrationTest.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,9 @@ public virtual void Create_table_with_HasDefaultValueSql()
4242
CONSTRAINT `PK_Cookie` PRIMARY KEY (`CookieId`)
4343
);
4444
45-
4645
INSERT INTO `Cookie` (`CookieId`, `Name`)
4746
VALUES (1, 'Basic');
4847
49-
5048
SELECT `c`.`CookieId`, `c`.`BestServedBefore`, `c`.`Name`
5149
FROM `Cookie` AS `c`");
5250
}
@@ -108,15 +106,13 @@ public virtual void Create_many_to_many_table_with_explicit_counter_column_type(
108106
CONSTRAINT `PK_Backery` PRIMARY KEY (`BackeryId`)
109107
);
110108
111-
112109
CREATE TABLE `Cookie` (
113110
`CookieId` counter NOT NULL,
114111
`Name` longchar NULL,
115112
`BestServedBefore` datetime NOT NULL,
116113
CONSTRAINT `PK_Cookie` PRIMARY KEY (`CookieId`)
117114
);
118115
119-
120116
CREATE TABLE `CookieBackery` (
121117
`CookieId` integer NOT NULL,
122118
`BackeryId` integer NOT NULL,
@@ -125,22 +121,17 @@ public virtual void Create_many_to_many_table_with_explicit_counter_column_type(
125121
CONSTRAINT `FK_CookieBackery_Cookie_CookieId` FOREIGN KEY (`CookieId`) REFERENCES `Cookie` (`CookieId`) ON DELETE CASCADE
126122
);
127123
128-
129124
INSERT INTO `Backery` (`BackeryId`, `Name`)
130125
VALUES (1, 'Bread & Cookies');
131126
132-
133127
INSERT INTO `Cookie` (`CookieId`, `BestServedBefore`, `Name`)
134128
VALUES (1, #1899-12-30#, 'Chocolate Chip');
135129
136-
137130
INSERT INTO `CookieBackery` (`BackeryId`, `CookieId`)
138131
VALUES (1, 1);
139132
140-
141133
CREATE INDEX `IX_CookieBackery_BackeryId` ON `CookieBackery` (`BackeryId`);
142134
143-
144135
SELECT `c`.`CookieId`, `c`.`BackeryId`, `c0`.`CookieId`, `c0`.`BestServedBefore`, `c0`.`Name`, `b`.`BackeryId`, `b`.`Name`
145136
FROM (`CookieBackery` AS `c`
146137
INNER JOIN `Cookie` AS `c0` ON `c`.`CookieId` = `c0`.`CookieId`)
@@ -204,15 +195,13 @@ public virtual void Create_many_to_many_table_with_explicit_int_column_type()
204195
CONSTRAINT `PK_Backery` PRIMARY KEY (`BackeryId`)
205196
);
206197
207-
208198
CREATE TABLE `Cookie` (
209199
`CookieId` counter NOT NULL,
210200
`Name` longchar NULL,
211201
`BestServedBefore` datetime NOT NULL,
212202
CONSTRAINT `PK_Cookie` PRIMARY KEY (`CookieId`)
213203
);
214204
215-
216205
CREATE TABLE `CookieBackery` (
217206
`CookieId` integer NOT NULL,
218207
`BackeryId` integer NOT NULL,
@@ -221,22 +210,17 @@ public virtual void Create_many_to_many_table_with_explicit_int_column_type()
221210
CONSTRAINT `FK_CookieBackery_Cookie_CookieId` FOREIGN KEY (`CookieId`) REFERENCES `Cookie` (`CookieId`) ON DELETE CASCADE
222211
);
223212
224-
225213
INSERT INTO `Backery` (`BackeryId`, `Name`)
226214
VALUES (1, 'Bread & Cookies');
227215
228-
229216
INSERT INTO `Cookie` (`CookieId`, `BestServedBefore`, `Name`)
230217
VALUES (1, #1899-12-30#, 'Chocolate Chip');
231218
232-
233219
INSERT INTO `CookieBackery` (`BackeryId`, `CookieId`)
234220
VALUES (1, 1);
235221
236-
237222
CREATE INDEX `IX_CookieBackery_BackeryId` ON `CookieBackery` (`BackeryId`);
238223
239-
240224
SELECT `c`.`CookieId`, `c`.`BackeryId`, `c0`.`CookieId`, `c0`.`BestServedBefore`, `c0`.`Name`, `b`.`BackeryId`, `b`.`Name`
241225
FROM (`CookieBackery` AS `c`
242226
INNER JOIN `Cookie` AS `c0` ON `c`.`CookieId` = `c0`.`CookieId`)
@@ -306,15 +290,13 @@ public virtual void Create_many_to_many_table_with_inappropriate_counter_column_
306290
CONSTRAINT `PK_Backery` PRIMARY KEY (`BackeryId`)
307291
);
308292
309-
310293
CREATE TABLE `Cookie` (
311294
`CookieId` counter NOT NULL,
312295
`Name` longchar NULL,
313296
`BestServedBefore` datetime NOT NULL,
314297
CONSTRAINT `PK_Cookie` PRIMARY KEY (`CookieId`)
315298
);
316299
317-
318300
CREATE TABLE `CookieBackery` (
319301
`CookieId` integer NOT NULL,
320302
`BackeryId` integer NOT NULL,
@@ -323,22 +305,17 @@ public virtual void Create_many_to_many_table_with_inappropriate_counter_column_
323305
CONSTRAINT `FK_CookieBackery_Cookie_CookieId` FOREIGN KEY (`CookieId`) REFERENCES `Cookie` (`CookieId`) ON DELETE CASCADE
324306
);
325307
326-
327308
INSERT INTO `Backery` (`BackeryId`, `Name`)
328309
VALUES (1, 'Bread & Cookies');
329310
330-
331311
INSERT INTO `Cookie` (`CookieId`, `BestServedBefore`, `Name`)
332312
VALUES (1, #1899-12-30#, 'Chocolate Chip');
333313
334-
335314
INSERT INTO `CookieBackery` (`BackeryId`, `CookieId`)
336315
VALUES (1, 1);
337316
338-
339317
CREATE INDEX `IX_CookieBackery_BackeryId` ON `CookieBackery` (`BackeryId`);
340318
341-
342319
SELECT `c`.`CookieId`, `c`.`BackeryId`, `c0`.`CookieId`, `c0`.`BestServedBefore`, `c0`.`Name`, `b`.`BackeryId`, `b`.`Name`
343320
FROM (`CookieBackery` AS `c`
344321
INNER JOIN `Cookie` AS `c0` ON `c`.`CookieId` = `c0`.`CookieId`)

test/EFCore.Jet.Tests/TestBase.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Linq;
34
using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities;
45
using EntityFrameworkCore.Jet.Infrastructure;
56
using Microsoft.EntityFrameworkCore;
@@ -19,7 +20,7 @@ public TestBase()
1920
public virtual string StoreName => GetType().Name;
2021
public virtual JetTestStore TestStore { get; }
2122
public virtual List<string> SqlCommands { get; } = new List<string>();
22-
public virtual string Sql => string.Join("\n\n", SqlCommands);
23+
public virtual string Sql => string.Join("\n\n", SqlCommands.Select(c => c.Trim('\r', '\n')));
2324

2425
public virtual TContext CreateContext(
2526
Action<JetDbContextOptionsBuilder> jetOptions = null,

0 commit comments

Comments
 (0)