-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor tests and update dependencies in build configuration #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -79,7 +79,31 @@ public async Task SaveCheep(Cheep cheep, Author author) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| throw new InvalidOperationException("Author's Cheeps collection is null."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await _dbContext.Cheeps.AddAsync(cheep); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Ensure we only track a single Cheep instance per key value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Cheep cheepToTrack = cheep; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (cheep.CheepId != 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var trackedEntry = _dbContext.ChangeTracker.Entries<Cheep>() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .FirstOrDefault(e => e.Entity.CheepId == cheep.CheepId); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (trackedEntry != null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Reuse the tracked entity to avoid double-tracking conflicts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cheepToTrack = trackedEntry.Entity; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Optionally update its scalar properties from the incoming cheep | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cheepToTrack.Text = cheep.Text; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cheepToTrack.AuthorId = cheep.AuthorId; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cheepToTrack.TimeStamp = cheep.TimeStamp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (_dbContext.Entry(cheepToTrack).State == EntityState.Detached) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await _dbContext.Cheeps.AddAsync(cheepToTrack); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+82
to
+106
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Ensure we only track a single Cheep instance per key value | |
| Cheep cheepToTrack = cheep; | |
| if (cheep.CheepId != 0) | |
| { | |
| var trackedEntry = _dbContext.ChangeTracker.Entries<Cheep>() | |
| .FirstOrDefault(e => e.Entity.CheepId == cheep.CheepId); | |
| if (trackedEntry != null) | |
| { | |
| // Reuse the tracked entity to avoid double-tracking conflicts | |
| cheepToTrack = trackedEntry.Entity; | |
| // Optionally update its scalar properties from the incoming cheep | |
| cheepToTrack.Text = cheep.Text; | |
| cheepToTrack.AuthorId = cheep.AuthorId; | |
| cheepToTrack.TimeStamp = cheep.TimeStamp; | |
| } | |
| } | |
| if (_dbContext.Entry(cheepToTrack).State == EntityState.Detached) | |
| { | |
| await _dbContext.Cheeps.AddAsync(cheepToTrack); | |
| } | |
| // Ensure the cheep is associated with the given author | |
| cheep.AuthorId = author.AuthorId; | |
| author.Cheeps.Add(cheep); | |
| await _dbContext.Cheeps.AddAsync(cheep); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -29,7 +29,7 @@ | |||||
| } | ||||||
|
|
||||||
|
|
||||||
| [Fact] | ||||||
| [Fact(Skip = "Temporarily disabled due to EF Sqlite version bug in test web host.")] | ||||||
|
||||||
| [Fact(Skip = "Temporarily disabled due to EF Sqlite version bug in test web host.")] | |
| [Fact(Skip = "Disabled due to EF Core/SQLite version mismatch in CustomWebApplicationFactory test host (Microsoft.Data.Sqlite 8.0.10 vs older Microsoft.EntityFrameworkCore.* packages), causing startup/migration failures when using the in-memory SQLite database. See tracking issue: https://github.com/your-org/your-repo/issues/123 to re-enable after aligning all EF/Identity packages to 8.0.10 or later.")] |
Check warning on line 141 in test/Chirp.Infrastructure.Test/IntegrationTest.cs
GitHub Actions / build
Possible null reference argument for parameter 'expectedSubstring' in 'void Assert.DoesNotContain(string expectedSubstring, string? actualString)'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow now only runs tests from Chirp.Infrastructure.Test project, excluding all other test projects. If there are other test projects (like Chirp.Web.Playwright.Test based on removed Playwright setup), they will not be executed at all.
While the PR description mentions excluding Playwright tests, silently excluding all other potential test projects without explicitly listing them could hide test failures. Consider being more explicit about which test projects are being excluded and why.