create-integration-test

Generates C# integration test classes using BaseTest, CustomWebApplicationFactory, and Shouldly assertions.

Updated Nov 19, 2020
One-click install
npx skills add https://github.com/kwojtasinski-repo/ECommerceApp --skill create-integration-test-kwojtasinski-repo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-integration-test
Source: https://github.com/kwojtasinski-repo/ECommerceApp/tree/main/.github/skills/create-integration-test
Command: npx skills add https://github.com/kwojtasinski-repo/ECommerceApp --skill create-integration-test-kwojtasinski-repo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing integration tests for service-layer code requires consistent setup of DI containers, in-memory databases, and assertion patterns. This Skill scaffolds a complete, convention-compliant integration test class so developers avoid recreating test infrastructure or mixing up assertion libraries. ## Core Features & Use Cases - Test Class Scaffolding: Generates a full xUnit test class inheriting from BaseTest<T> with CRUD and pagination test methods. - Convention Enforcement: Ensures Shouldly assertions, real DI resolution, and in-memory EF Core database usage per project standards. - Infrastructure Awareness: References existing BaseTest, CustomWebApplicationFactory, and TestDatabaseInitializer classes so they are never duplicated. - Use Case: When adding a new service like OrderService in the Orders bounded context, generate a ready-to-run OrderServiceTests.cs with seeded-data assertions in seconds. ## Quick Start Ask the AI to create an integration test for your service, for example: create an integration test for IOrderService in the Orders bounded context.

Frequently Asked Questions about create-integration-test

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

FAQPage Schema
How do I write integration tests for a service layer in ASP.NET Core?

Create a test class inheriting from BaseTest<IYourService>, which resolves the service from the DI container and exposes it via the _service field. Use xUnit [Fact] methods with Shouldly assertions against an in-memory EF Core database seeded by TestDatabaseInitializer.

Shouldly vs FluentAssertions for integration tests in .NET?

This project uses Shouldly for integration tests and FluentAssertions for unit tests, per project convention. Shouldly provides readable assertion messages like result.ShouldNotBeNull() and result.Id.ShouldBe(id).

Can I use Moq mocks in integration tests with an in-memory database?

No. Integration tests in this setup use a real DI container with no mocks, unlike unit tests which mock all dependencies with Moq. The CustomWebApplicationFactory replaces SQL Server with an EF Core InMemory database.

How do I test a service that requires an authenticated user?

Call SetHttpContextUserId(userId) from the BaseTest class before invoking the service method. This simulates an authenticated user context without needing a real HTTP request pipeline.

Why does my integration test fail when asserting seeded data?

Assertions fail when expected entities do not match what TestDatabaseInitializer seeds into the in-memory database. Check the initializer first to confirm which IDs and field values exist before writing assertions.