All three integration tests run against an in-memory SQLite database that is created and torn down automatically by the test fixture — no PostgreSQL credentials, no Supabase project, and no running API instance are needed. Anyone who clones the repository can execute the full suite immediately after restoring packages.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/marchena96/Paradigma-lab1/llms.txt
Use this file to discover all available pages before exploring further.
Quick run
From the repository root, restore, build, and run all tests in one line:--logger xunit flag writes an XML report compatible with most CI test dashboards. The --results-directory flag controls where that file lands.
Step-by-step
Navigate to the repository root
All
dotnet commands below should be run from the directory that contains HackerRank1.sln:Restore NuGet packages
Downloads all declared dependencies for both the API project and the test project:
Build the solution
Compiles both The build should complete with 0 errors. A small number of nullable-reference warnings (
HackerRank1 (the API) and LibraryService.Integration.Test:CS8618, CS8603, CS8625) are cosmetic and do not affect correctness.Expected output
A successful run reports all three tests as passing. The xUnit console output looks similar to the following:| Test name | What it verifies |
|---|---|
TestAddBook_Ok_GetBook_NotFound | POST book → 201 for existing library; 404 for non-existent library |
TestGetBooks_Ok_NotFound | GET books → 200 with correct count; 404 for non-existent library |
TestDeleteLibrary | DELETE library → 204; follow-up GET → 404; repeat DELETE → 404 |
Test isolation
Each instantiation of theIntegrationTests class gets its own WebApplicationFactory<Program> and its own LibraryContext backed by a fresh DataSource=:memory: SQLite connection. Because SQLite in-memory databases are scoped to a single open connection, two test instances can never share rows, even when running in parallel.
The ChangeTracker is also cleared after each seed operation so that EF Core does not cache entity state across test steps. As a result, every [Fact] begins with an empty database that is populated only by its own seed calls.
CI/CD
No environment variables or secrets are required to run the test suite. The live PostgreSQL/Supabase database is completely replaced by SQLite in-memory inside theWebApplicationFactory, so a bare dotnet test is all any CI runner needs:
ConnectionStrings:DefaultConnection secret (used by the live app) is not read during test execution and does not need to be injected into the CI environment.
If you have the live API running (
dotnet run --project HackerRank1) in another terminal when you try to build, stop it first. The .exe produced by the previous build is locked by the running process, and MSBuild will fail with errors MSB3027/MSB3021 (“Could not copy … because it is being used by another process”).