internals-visible-to-tests

Add InternalsVisibleTo entries in csproj files to expose internal members to matching test assemblies.

Updated Apr 13, 2026
One-click install
npx skills add https://github.com/AdaskoTheBeAsT/AdaskoTheBeAsT.Interop --skill internals-visible-to-tests
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: internals-visible-to-tests
Source: https://github.com/AdaskoTheBeAsT/AdaskoTheBeAsT.Interop/tree/main/.factory/skills/internals-visible-to-tests
Command: npx skills add https://github.com/AdaskoTheBeAsT/AdaskoTheBeAsT.Interop --skill internals-visible-to-tests

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Expose the smallest possible internal surface to matching test projects when a behavior is too hard to verify indirectly through the public API alone.

Core Features & Use Cases

  • Identify candidate private members for internal visibility and add InternalsVisibleTo entries for test assemblies using common naming patterns
  • Preserve the public API by widening visibility only when direct testing justifies it
  • Streamline testability in projects where source and test assemblies share a base name (e.g., Lib and Lib.Tests) and suffixes (.Test, .Tests, .IntegrationTest, .IntegrationTests)

Quick Start

Add an InternalsVisibleTo entry to the source project for your matching test assembly and run tests to verify behavior.

Frequently Asked Questions about internals-visible-to-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I expose internal members to my test assemblies without widening the public API in C#?

To expose internal members for testing, add an InternalsVisibleTo entry to your source project's csproj file for the matching test assembly, then run tests to verify the private behavior directly.

What naming patterns does InternalsVisibleTo support for matching test assemblies in .NET?

InternalsVisibleTo matches test assemblies sharing a base name with the source project and using common suffixes such as .Test, .Tests, .IntegrationTest, or .IntegrationTests.

When should I use InternalsVisibleTo instead of making a method public for testability?

Use InternalsVisibleTo when behavior is too hard to verify indirectly through the public API, allowing direct testing of private members while preserving the public API surface.

Can I use InternalsVisibleTo with integration test projects in dotnet?

Yes, InternalsVisibleTo works with integration test projects that share the source project's base name and use the .IntegrationTest or .IntegrationTests suffix in their assembly name.

What limitations should I consider before adding InternalsVisibleTo to my csproj?

InternalsVisibleTo requires source and test projects to share base names with specific suffixes, exposing internal members to the entire test assembly, so only widen visibility when direct testing justifies it.