Refactor test code for improved readability and organization#32
Merged
Refactor test code for improved readability and organization#32
Conversation
…nd maintainability - Updated `UnverifiedAccountCleanupTests` to include `BookStore.AppHost.Tests.Helpers`. - Refactored `UpdateTests` to replace `TestHelpers` with `HttpClientHelpers`, `FakeDataGenerators`, and specific entity helpers for authors, categories, publishers, and books. - Modified `WebTests` to include `BookStore.AppHost.Tests.Helpers`.
There was a problem hiding this comment.
Pull request overview
This pull request refactors test code by breaking down a monolithic TestHelpers.cs file (1649 lines) into smaller, focused helper classes organized in a Helpers namespace. The refactoring improves code organization, readability, and maintainability by grouping related functionality together. All test files have been updated to use the new helper methods with standardized using directives.
Changes:
- Deleted monolithic
TestHelpers.csand split functionality into 10 specialized helper classes - Created organized helper classes:
AuthenticationHelpers,AuthorHelpers,BookHelpers,CategoryHelpers,DatabaseHelpers,FakeDataGenerators,HttpClientHelpers,PublisherHelpers,ShoppingCartHelpers, andSseEventHelpers - Updated 50+ test files to use new helper methods with consistent naming patterns
- Added standardized
using BookStore.AppHost.Tests.Helpers;directive across all test files - Minor formatting improvements to AGENTS.md
Reviewed changes
Copilot reviewed 63 out of 63 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| TestHelpers.cs | Deleted 1649-line monolithic helper file |
| Helpers/AuthenticationHelpers.cs | New: User authentication, login, and registration helpers |
| Helpers/AuthorHelpers.cs | New: Author CRUD operation helpers |
| Helpers/BookHelpers.cs | New: Book CRUD, rating, and favorites helpers |
| Helpers/CategoryHelpers.cs | New: Category CRUD operation helpers |
| Helpers/DatabaseHelpers.cs | New: Database access and tenant seeding helpers |
| Helpers/FakeDataGenerators.cs | New: Test data generation using Bogus |
| Helpers/HttpClientHelpers.cs | New: HTTP client creation and configuration helpers |
| Helpers/PublisherHelpers.cs | New: Publisher CRUD operation helpers |
| Helpers/ShoppingCartHelpers.cs | New: Shopping cart operation helpers |
| Helpers/SseEventHelpers.cs | New: SSE event listening and waiting helpers |
| 50+ test files | Updated to use new helper methods with standardized imports |
| PasskeyTestHelpers.cs | Updated to use DatabaseHelpers |
| AGENTS.md | Minor formatting improvements with blank lines |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor test code to utilize new helper methods, enhancing readability and maintainability. Standardize using directives across test files for better organization.