Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 28, 2025

Adds CI automation and unit test infrastructure to establish baseline reliability for the repository.

Changes

  • CI Workflow (.github/workflows/ci.yml)

    • Runs on PR and main branch pushes
    • Ubuntu + .NET 10.0.x with restore → build → test pipeline
    • Minimal permissions (contents: read)
  • Test Project (tests/DataAccessProvider.Core.Tests/)

    • xUnit on net10.0
    • 21 unit tests covering:
      • Factory registration and data source routing (DataSourceFactoryTests)
      • Provider execution methods (DataSourceProviderTests)
      • Dictionary extension null/DBNull edge cases (ObjectExtensionsTests)
      • Parameter value setting (BaseDataSourceParamsTests)
    • No external dependencies (uses StaticCodeSource for isolation)

Example test demonstrating factory routing:

[Fact]
public void CreateDataSource_WithStaticCodeParams_ShouldReturnStaticCodeSource()
{
    var services = new ServiceCollection();
    services.AddTransient<StaticCodeSource>();
    var factory = new DataSourceFactory(services.BuildServiceProvider());
    var parameters = new StaticCodeParams { Content = "test" };

    var dataSource = factory.CreateDataSource(parameters);

    Assert.IsType<StaticCodeSource>(dataSource);
}

All tests execute via dotnet test DataAccessProvider.sln without requiring database connections.

Original prompt

Create reliability/CI improvements for this repository.

Repository: https://github.com/habbs19/DataAccessProvider

Goals

  1. Add a GitHub Actions CI workflow that runs on pull_request and on pushes to main using ubuntu-latest and .NET SDK 10.0.x.

    • Steps: checkout, setup-dotnet, restore, build (Release), test (Release).
    • The workflow should run against DataAccessProvider.sln.
  2. Add a new test project targeting net10.0 only:

    • Location: tests/DataAccessProvider.Core.Tests/
    • Framework: xUnit
    • Add package refs: Microsoft.NET.Test.Sdk, xunit, xunit.runner.visualstudio.
    • Reference the DataAccessProvider.Core project.
    • Ensure the new test project is included in DataAccessProvider.sln so dotnet test DataAccessProvider.sln executes it.
  3. Add a few starter, fast unit tests that do not require external databases:

    • Test that the factory/provider registration and routing works for at least one provider type (mock/stub if needed).
    • Test one typed mapping/materialization edge case if a mapper exists in Core (e.g., null/DBNull handling). If the internal API is not easily testable without DB drivers, add tests around public helpers that are available.

Constraints

  • Ubuntu runner only.
  • Keep tests deterministic and not requiring network or real databases.

Acceptance Criteria

  • CI workflow is present and passes on a clean checkout.
  • dotnet test DataAccessProvider.sln runs and executes the new tests.
  • The PR contains CI + tests project + initial tests.

This pull request was created from Copilot chat.


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

Copilot AI and others added 2 commits December 28, 2025 03:58
Co-authored-by: habbs19 <35790658+habbs19@users.noreply.github.com>
Co-authored-by: habbs19 <35790658+habbs19@users.noreply.github.com>
Copilot AI changed the title [WIP] Add GitHub Actions CI workflow and new test project Add CI workflow and unit test coverage for DataAccessProvider.Core Dec 28, 2025
Copilot AI requested a review from habbs19 December 28, 2025 04:06
@habbs19 habbs19 marked this pull request as ready for review December 28, 2025 04:53
@habbs19 habbs19 merged commit 68069bf into main Dec 28, 2025
1 check failed
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