Commit 7015b21
Bart Koelman
Fix for non-deterministic failing tests (#669)
* Moved tests for `NoEntityFrameworkTests` into a different database, because two variants of `TodoItem` exist (where one is a subset of the other), causing tests to fail/succeed depending on their execution order.
A separate database is needed instead of schema, because `context.Database.EnsureCreated()` only checks for database existence and does not create additional tables when the database already exists.
Furthermore, I decided to remove fields from `NoEntityFrameworkExample.Models.TodoItem` that do not exist in the INSERT SQL statement in `NoEntityFrameworkExample.Services.TodoItemService` and because non-nullable CreatedDate causes insert to fail.
* Fixed another bug, where tests would sometimes fail
This occured when working in the solution for a while, building and rebuilding one or more projects individually. What happened is that the appsettings.json from NoEntityFrameworkCoreExample project would overwrite the one from JsonApiDotNetCoreExample in the output folder of JsonApiDotNetCoreExample. Causing that project to reference the wrong database.
I solved this by removing the unneeded dependency between these projects and by relying on automatic copying of appsettings by the project system. I removed the copied appsettings.json files from the test projects, which end up in the output directory anyway (because they reference the *Example projects).
* Fixed invalid logging configuration1 parent d7d8a79 commit 7015b21
File tree
7 files changed
+6
-51
lines changed- src/Examples
- JsonApiDotNetCoreExample
- NoEntityFrameworkExample
- Models
- test
- JsonApiDotNetCoreExampleTests
- NoEntityFrameworkTests
7 files changed
+6
-51
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
| 11 | + | |
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | 23 | | |
36 | 24 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
This file was deleted.
0 commit comments