fix(quality): make Web feature types internal (CA1515)#147
Merged
mpaulosky merged 3 commits intoApr 24, 2026
Conversation
- Changed 23 top-level types from public to internal in Web features, data, infrastructure, and security layers - Added InternalsVisibleTo entries in AssemblyInfo.cs for all test assemblies (Architecture.Tests, Web.Tests, Web.Tests.Bunit, Web.Tests.Integration, Unit.Tests, DynamicProxyGenAssembly2) - Changed RedisFixture.CreateCacheService() to internal to match IBlogPostCacheService visibility Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
🏗️ PR Added to Squad Triage QueueThis PR has been labeled with Next steps:
|
There was a problem hiding this comment.
Pull request overview
Reduces the public surface area of the Web assembly by making non-API application-layer feature/data/caching types internal to satisfy CA1515, while preserving test access via InternalsVisibleTo.
Changes:
- Changed CQRS feature commands/queries/handlers/validators and supporting DTOs/services from
publictointernalwithinsrc/Web. - Added
InternalsVisibleToentries for test assemblies andDynamicProxyGenAssembly2(NSubstitute/Castle proxy generation). - Updated integration test fixture method visibility to align with the now-internal caching abstractions.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Web.Tests.Integration/Infrastructure/RedisFixture.cs | Adjusted fixture factory method visibility to match internal caching types. |
| src/Web/Security/RoleClaimsHelper.cs | Made helper type internal to reduce public API surface. |
| src/Web/Properties/AssemblyInfo.cs | Added InternalsVisibleTo for test assemblies and dynamic proxy generation. |
| src/Web/Infrastructure/Caching/IBlogPostCacheService.cs | Made caching abstraction internal. |
| src/Web/Infrastructure/Caching/CachingServiceExtensions.cs | Made DI extension type internal. |
| src/Web/Infrastructure/Caching/BlogPostCacheKeys.cs | Made cache key constants type internal. |
| src/Web/Features/UserManagement/UserManagementHandler.cs | Made handler internal. |
| src/Web/Features/UserManagement/RemoveRoleCommand.cs | Made command internal. |
| src/Web/Features/UserManagement/GetUsersWithRolesQuery.cs | Made query + DTO internal. |
| src/Web/Features/UserManagement/GetAvailableRolesQuery.cs | Made query + DTO internal. |
| src/Web/Features/UserManagement/AssignRoleCommand.cs | Made command internal. |
| src/Web/Features/BlogPosts/List/GetBlogPostsQuery.cs | Made query internal. |
| src/Web/Features/BlogPosts/List/GetBlogPostsHandler.cs | Made handler internal. |
| src/Web/Features/BlogPosts/Edit/GetBlogPostByIdQuery.cs | Made query internal. |
| src/Web/Features/BlogPosts/Edit/EditBlogPostHandler.cs | Made handler internal. |
| src/Web/Features/BlogPosts/Edit/EditBlogPostCommandValidator.cs | Made validator internal. |
| src/Web/Features/BlogPosts/Edit/EditBlogPostCommand.cs | Made command internal. |
| src/Web/Features/BlogPosts/Delete/DeleteBlogPostHandler.cs | Made handler internal. |
| src/Web/Features/BlogPosts/Delete/DeleteBlogPostCommandValidator.cs | Made validator internal. |
| src/Web/Features/BlogPosts/Delete/DeleteBlogPostCommand.cs | Made command internal. |
| src/Web/Features/BlogPosts/Create/CreateBlogPostHandler.cs | Made handler internal. |
| src/Web/Features/BlogPosts/Create/CreateBlogPostCommandValidator.cs | Made validator internal. |
| src/Web/Features/BlogPosts/Create/CreateBlogPostCommand.cs | Made command internal. |
| src/Web/Data/MongoDbBlogPostRepository.cs | Made repository implementation internal. |
| src/Web/Data/BlogPostDto.cs | Made DTO internal. |
Contributor
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## sprint/6-code-quality #147 +/- ##
======================================================
Coverage 72.12% 72.12%
======================================================
Files 43 43
Lines 721 721
Branches 112 112
======================================================
Hits 520 520
Misses 150 150
Partials 51 51
🚀 New features to boost your workflow:
|
…d/138-make-web-types-internal
…mocking of internal types
Without InternalsVisibleTo("DynamicProxyGenAssembly2"), Castle DynamicProxy
cannot create proxies for internal sealed classes, causing all NSubstitute-
based Web.Tests to fail at constructor time.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
4 tasks
mpaulosky
added a commit
that referenced
this pull request
Apr 25, 2026
## Sprint 6: Code Quality **Goal:** Eliminate analyzer warnings, enforce internal visibility on Web feature types, expand test coverage, and migrate Unit.Tests into Web.Tests. --- ## Merged Feature PRs - Closes #137 — PR #144 — fix(quality): rename `ct` → `cancellationToken` in all MediatR handlers - Closes #138 — PR #145 — test: add unit tests for BlogPost, Result, and ValidationBehavior (42 tests) - Closes #139 — PR #146 — test: add unit tests for UserManagementHandler (16 tests) - Closes #140 — PR #147 — fix(quality): make Web feature types `internal` (CA1515, ~28 types) - Closes #141 — PR #148 — test: add unit tests for BlogPostMappings (22 tests) - Closes #142 — PR #149 — fix(quality): add ConfigureAwait(false) and specific exception catches - Closes #143 — PR #150 — fix(quality): address Domain and ServiceDefaults analyzer warnings - Closes #151 — PR #152 — feat(tests): migrate Unit.Tests → Web.Tests and remove Unit.Tests project --- ## Test Summary - **80+ new tests** added across all PRs - **105 Web.Tests passing** (0 failures) - `DynamicProxyGenAssembly2` added to `InternalsVisibleTo` in Web.csproj for NSubstitute support ## Notable Changes - `Unit.Tests` project removed; all tests now live in `Web.Tests` - ~28 Web feature types changed from `public` to `internal` (CA1515 compliance) - All MediatR handler parameters renamed from `ct` to `cancellationToken` for clarity - `ConfigureAwait(false)` applied to all async calls in service layer - Domain and ServiceDefaults analyzer warnings resolved --- ## Checklist - [x] All sprint issues closed (#137–#143, #151) - [x] CI green (0 build errors) - [x] 105 Web.Tests passing - [x] Milestone at 100% --------- Co-authored-by: Boromir <boromir@squad.dev> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
Closes #138
Working as Boromir (Backend/.NET)
Makes all Web feature types
internalper CA1515 — application-level types that are not part of a public API should not bepublic.Changes
23 types changed
public→internalacross:Features/BlogPosts/Create— Command, Validator, HandlerFeatures/BlogPosts/Delete— Command, Validator, HandlerFeatures/BlogPosts/Edit— Command, Validator, Handler, GetBlogPostByIdQueryFeatures/BlogPosts/List— Handler, QueryFeatures/UserManagement— AssignRoleCommand, RemoveRoleCommand, GetAvailableRolesQuery, RoleDto, GetUsersWithRolesQuery, UserWithRolesDto, HandlerData— BlogPostDto, MongoDbBlogPostRepositoryInfrastructure/Caching— BlogPostCacheKeys, IBlogPostCacheService, CachingServiceExtensionsSecurity— RoleClaimsHelperAssembly visibility updated (
src/Web/Properties/AssemblyInfo.cs):InternalsVisibleTofor Architecture.Tests, Web.Tests, Web.Tests.Bunit, Web.Tests.IntegrationInternalsVisibleTo("DynamicProxyGenAssembly2")for NSubstitute proxy generationTest fix (
tests/Web.Tests.Integration/Infrastructure/RedisFixture.cs):CreateCacheService()frompublic→internalto matchIBlogPostCacheServicevisibilityVerification