Skip to content

[WIP] Setup integration test environment with DB persistence - #138

Closed
AntoMars14 with Copilot wants to merge 1 commit into
integration-testsfrom
copilot/setup-integration-test-environment
Closed

[WIP] Setup integration test environment with DB persistence#138
AntoMars14 with Copilot wants to merge 1 commit into
integration-testsfrom
copilot/setup-integration-test-environment

Conversation

Copilot AI commented Feb 5, 2026

Copy link
Copy Markdown
Contributor
  • Verify agent instructions for backend test integration (if accessible)
  • Add SQLite test dependencies to ServerTests project
  • Add SQLite persistence integration test for ApplicationDbContext
  • Run targeted dotnet test to validate new persistence test
Original prompt

TASK: Setup Integration Test Environment & DB Persistence

Reference Context:
Please strictly follow the rules defined in .github/agent/backend-testintegration-agent.md.

Step 1: Dependencies Check
Check ServerTests/nam.ServerTests.csproj. We need to run tests using SQLite in-memory to avoid external dependencies.
If missing, run the dotnet commands to add these packages to the test project:

  • Microsoft.EntityFrameworkCore.Sqlite
  • Microsoft.Data.Sqlite

Step 2: Database Integration Test
Create a new test class under ServerTests/Integration/Database/PersistenceTests.cs.

  • Goal: Verify that we can save and retrieve a basic entity (e.g., a User or the simplest entity available in Domain).
  • Setup:
    • Create a new ApplicationDbContext using DbContextOptionsBuilder configured with UseSqlite("DataSource=:memory:").
    • Important: Open the connection explicitly (connection.Open()) and pass it to the options, otherwise the in-memory DB will vanish when EF closes the connection.
    • Call EnsureCreated() to build the schema.
  • Test:
    • Add an entity -> SaveChanges().
    • Create a new Context instance (using the same open connection) to verify data was actually persisted and not just cached in local memory.
    • Assert the data exists.

Step 3: Verify
Run dotnet test to confirm the persistence logic works and packages are correct.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants