-
Notifications
You must be signed in to change notification settings - Fork 6
add UserRepository tests #122
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
Conversation
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.
Pull request overview
This PR adds comprehensive integration tests for the IUserRepository interface, covering all six methods: ListUsersAsync, ListCategoryModerators, GetUserAsync, CreateUserAsync, EditUserAsync, and SetUserDeletedAsync. Additionally, it introduces a new TestDataBuilder.Role.cs partial class to support role and user management in tests, and refactors existing test assertions to use a more type-safe pattern (Is.TypeOf<T>() instead of IsT0/IsT1 checks).
Key changes:
- Added 6 new test files with 32 test cases covering UserRepository functionality including edge cases, filtering, role management, and error scenarios
- Introduced
TestDataBuilder.Role.cswith methods for creating roles, users, and managing role assignments with deferred execution pattern - Refactored assertion patterns in Thread and Ban repository tests to use
Is.TypeOf<Success>()andHttpStatusCodeenum values for better type safety and readability
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| SetUserDeletedTests.cs | Tests for soft-deleting and restoring users, including idempotency and isolation checks |
| ListUsersTests.cs | Tests for listing users with filters (deleted/active), role information, and user details |
| ListCategoryModeratorsTests.cs | Tests for retrieving moderators by category with assignment flags, including multi-role and cross-category scenarios |
| GetUserTests.cs | Tests for retrieving individual users by ID, including non-existent users, role information, and deleted users |
| EditUserTests.cs | Tests for updating user properties, role assignments, lockout settings, and error handling |
| CreateUserTests.cs | Tests for user creation with validation, duplicate detection, and timestamp verification |
| TestDataBuilder.Role.cs | New builder methods for roles and users with deferred role assignment pattern |
| TestDataBuilder.cs | Updated SaveAsync to apply pending user role assignments |
| EditThreadTests.cs | Refactored assertions to use type-safe pattern matching |
| CreateThreadTests.cs | Refactored assertions and replaced magic numbers with HttpStatusCode enum and Is.Zero |
| CreateBanTests.cs | Refactored assertions to use type-safe pattern matching and HttpStatusCode enum |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Pull request overview
Copilot reviewed 43 out of 43 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Hikkaba.Tests.Integration/Tests/Repositories/User/ListCategoryModeratorsTests.cs
Outdated
Show resolved
Hide resolved
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.
Pull request overview
Copilot reviewed 44 out of 44 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.