Repository inventory

kevintsengtw/dotnet-testing-agent-skills

Skills indexed from this repository, with install-style signals scoped to the repo.
16 skills304 GitHub stars0 weekly installsC#GitHubOwner profile

Overview

This skill is a practical guide to advanced AutoFixture customization for .NET tests. It explains how to integrate DataAnnotations, implement ISpecimenBuilder for precise control, and manage builder priority so generated test data matches business constraints. The content includes reusable generic numeric builders, DateTime range generators, and fluent extension methods for easy fixture composition.

How this skill works

The skill inspects property requests made to AutoFixture and provides custom values when a request matches configured predicates (property name, declaring type, or attribute). Custom ISpecimenBuilder implementations return a concrete value for matching requests or NoSpecimen to defer to the next builder. Insert(0) is used to ensure custom builders run before built-in relays that might intercept numeric or ranged values.

When to use it

  • When model validation attributes (StringLength, Range, etc.) must be honored in generated test data.
  • When specific properties need values constrained to a DateTime or numeric range.
  • When built-in AutoFixture generators produce undesired values for certain properties.
  • When creating reusable, type-safe range generators across multiple value types.
  • When you need deterministic but varied test datasets for integration or property tests.

Best practices

  • Leverage DataAnnotations on models and let AutoFixture respect them where possible.
  • Use Random.Shared for thread-safe, non-repeating random value generation.
  • Register numeric or property-specific builders with fixture.Customizations.Insert(0) to guarantee priority.
  • Keep specimen builders single-responsibility and return NoSpecimen for non-target requests.
  • Provide fluent extension methods to compose multiple range rules clearly in tests.

Example use cases

  • Create Persons where Name length and Age match StringLength and Range attributes automatically.
  • Control UpdateTime only, generating dates between two boundaries while leaving other DateTime fields untouched.
  • Enforce Price, Quantity, Rating, Discount ranges on Product objects using a generic NumericRangeBuilder<T>.
  • Replace built-in numeric generators for a domain property (e.g., Age) to avoid interception by RangeAttributeRelay.
  • Add chained AddRandomRange<T, TValue> calls to a Fixture to express complex test data constraints concisely.

FAQ

Built-in AutoFixture relays like RangeAttributeRelay or NumericSequenceGenerator can intercept numeric requests. Insert(0) puts your builder at highest priority so your rule executes first.

When should a builder return NoSpecimen?

Return NoSpecimen for any request your builder does not target (wrong type, property name, or attribute). This delegates creation to the next builder in the chain and avoids side effects.

16 skills

dotnet-testing-autofixture-customization
Automation

This skill guides advanced AutoFixture customization for .NET tests, enabling precise data generation with ISpecimenBuilder, DataAnnotations, and fluent

CsharpIntegration TestsTestingUnit Tests+1
dotnet-testing-autofixture-nsubstitute-integration
Automation

This skill streamlines .NET testing by auto-mocking interface dependencies with AutoFixture AutoNSubstitute, reducing boilerplate and improving test resilience.

CsharpIntegration TestsTestingUnit Tests+1
dotnet-testing-advanced
Ai

This skill helps you quickly match advanced .NET testing needs to the right sub-skills, enabling guided integration, container, and framework migration testing.

ApiCsharpDockerIntegration Tests+2
dotnet-testing-advanced-webapi-integration-testing
Api

This skill helps you build advanced WebApi integration tests using WebApplicationFactory, ProblemDetails validation, and multi-container test environments.

CsharpDockerIntegration TestsKubernetes+2
dotnet-testing-datetime-testing-timeprovider
Csharp

This skill helps you test time dependent logic in .NET by using TimeProvider, enabling controllable clocks, time freezing, and expiry scenarios.

Integration TestsTestingUnit TestsC#
dotnet-testing-advanced-aspire-testing
Cloud

This skill helps you implement end-to-end integration tests for .NET Aspire distributed apps using AppHost, container lifecycles, and real services.

CsharpDatabaseIntegration TestsTesting+1
dotnet-testing-awesome-assertions-guide
Code Review

This skill helps you write fluent, readable tests with AwesomeAssertions for objects, collections, and exceptions, boosting clarity and diagnostics.

CsharpIntegration TestsTestingUnit Tests+1
dotnet-testing-advanced-xunit-upgrade-guide
Csharp

This skill guides upgrading xUnit 2.x projects to 3.x, enabling migration best practices, async lifecycle updates, and new features for robust tests.

MigrationTestingC#
dotnet-testing-test-data-builder-pattern
Code Review

This skill helps you write clear, maintainable test data using the Test Data Builder pattern in .NET, improving test readability and reuse.

CsharpDesignIntegration TestsTesting+2
dotnet-testing-advanced-testcontainers-nosql
Backend

This skill guides advanced Testcontainers NoSQL integration testing for MongoDB and Redis, enabling efficient containerized tests with collection fixtures and

CsharpDataDatabaseDevops+4
dotnet-testing-unit-test-fundamentals
Csharp

This skill helps you implement .NET unit testing fundamentals with FIRST principles, AAA pattern, and xUnit guidance to improve test quality.

TestingUnit TestsC#
dotnet-testing-test-output-logging
Csharp

This skill guides implementing structured test output and logging in xUnit with ITestOutputHelper, AbstractLogger, and diagnostic tools for .NET tests.

DebuggingIntegration TestsTestingUnit Tests+1
dotnet-testing-advanced-testcontainers-database
Csharp

This skill enables realistic database testing with Testcontainers in .NET, orchestrating containerized SQL Server and PostgreSQL for EF Core and Dapper tests.

DatabaseDevopsInfraIntegration Tests+2
dotnet-testing-test-naming-conventions
Csharp

This skill helps you name tests and test classes using three-part naming, improving readability and consistency across .NET test suites.

Integration TestsTestingUnit TestsC#
dotnet-testing-advanced-tunit-advanced
Csharp

This skill enables advanced TUnit testing with data-driven, dependency injection, and integration testing techniques to boost reliability and coverage.

Integration TestsTestingUnit TestsC#
dotnet-testing-code-coverage-analysis
Ci Cd

This skill guides you through setting up, running, and interpreting code coverage for .NET tests, improving coverage reports and CI/CD integration.

Code ReviewCsharpDebuggingTesting+2
More from this maintainer
Other repositories and skills published under the same GitHub owner.
Skills library
Jump back to the full directory or explore grouped topics.
Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational