From afe8a41f6c24c8810d7338144a9a29fd2d35a5b2 Mon Sep 17 00:00:00 2001 From: Leon Hoppe Date: Sat, 18 Jan 2025 16:01:35 +0100 Subject: [PATCH 1/4] Created tests for the core module --- .gitlab-ci.yml | 39 ++++ .idea/.idea.HopFrame/.idea/workspace.xml | 58 +++-- HopFrame.sln | 9 + ...textConfigurator.cs => DbContextConfig.cs} | 0 src/HopFrame.Core/Config/HopFrameConfig.cs | 3 +- ...pertyConfigurator.cs => PropertyConfig.cs} | 3 +- .../{TableConfigurator.cs => TableConfig.cs} | 0 src/HopFrame.Core/HopFrame.Core.csproj | 6 + .../Config/DbContextConfiguratorTests.cs | 34 +++ .../Config/HopFrameConfiguratorTests.cs | 62 +++++ .../Config/PropertyConfiguratorTests.cs | 212 ++++++++++++++++++ .../Config/TableConfiguratorTests.cs | 151 +++++++++++++ .../HopFrame.Core.Tests.csproj | 27 +++ .../Models/MockDbContext.cs | 13 ++ tests/HopFrame.Core.Tests/Models/MockModel.cs | 7 + .../HopFrame.Core.Tests/Models/MockModel2.cs | 5 + .../Models/QueryProvider.cs | 129 +++++++++++ .../Services/ContextExplorerTests.cs | 132 +++++++++++ .../Services/DefaultAuthHandlerTests.cs | 41 ++++ .../Services/TableManagerTests.cs | 192 ++++++++++++++++ 20 files changed, 1097 insertions(+), 26 deletions(-) create mode 100644 .gitlab-ci.yml rename src/HopFrame.Core/Config/{DbContextConfigurator.cs => DbContextConfig.cs} (100%) rename src/HopFrame.Core/Config/{PropertyConfigurator.cs => PropertyConfig.cs} (99%) rename src/HopFrame.Core/Config/{TableConfigurator.cs => TableConfig.cs} (100%) create mode 100644 tests/HopFrame.Core.Tests/Config/DbContextConfiguratorTests.cs create mode 100644 tests/HopFrame.Core.Tests/Config/HopFrameConfiguratorTests.cs create mode 100644 tests/HopFrame.Core.Tests/Config/PropertyConfiguratorTests.cs create mode 100644 tests/HopFrame.Core.Tests/Config/TableConfiguratorTests.cs create mode 100644 tests/HopFrame.Core.Tests/HopFrame.Core.Tests.csproj create mode 100644 tests/HopFrame.Core.Tests/Models/MockDbContext.cs create mode 100644 tests/HopFrame.Core.Tests/Models/MockModel.cs create mode 100644 tests/HopFrame.Core.Tests/Models/MockModel2.cs create mode 100644 tests/HopFrame.Core.Tests/Models/QueryProvider.cs create mode 100644 tests/HopFrame.Core.Tests/Services/ContextExplorerTests.cs create mode 100644 tests/HopFrame.Core.Tests/Services/DefaultAuthHandlerTests.cs create mode 100644 tests/HopFrame.Core.Tests/Services/TableManagerTests.cs diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..9b68d7f --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,39 @@ +image: mcr.microsoft.com/dotnet/sdk:9.0 + +stages: + - build + - test + - publish + +before_script: + - echo "Setting up environment" + - 'dotnet --version' + +build: + stage: build + script: + - dotnet restore + - dotnet build --configuration Release --no-restore + artifacts: + paths: + - "**/bin/Release" + expire_in: 10 minutes + +test: + stage: test + script: + - dotnet test --verbosity normal + dependencies: + - build + +publish: + stage: publish + script: + - export VERSION=$(echo $CI_COMMIT_TAG | sed 's/^v//') + - dotnet pack -c Release -o . /p:Version=$VERSION + - for nupkg in *.nupkg; do dotnet nuget push $nupkg -k ${NUGET_API_KEY} -s https://api.nuget.org/v3/index.json; done + only: + - tags + dependencies: + - build + - test diff --git a/.idea/.idea.HopFrame/.idea/workspace.xml b/.idea/.idea.HopFrame/.idea/workspace.xml index 0705f65..66cd2af 100644 --- a/.idea/.idea.HopFrame/.idea/workspace.xml +++ b/.idea/.idea.HopFrame/.idea/workspace.xml @@ -9,17 +9,25 @@