diff --git a/.editorconfig b/.editorconfig index 326085a..2f25389 100644 --- a/.editorconfig +++ b/.editorconfig @@ -273,4 +273,4 @@ dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent dotnet_style_qualification_for_field = false:silent dotnet_style_qualification_for_property = false:error dotnet_style_qualification_for_method = false:error -dotnet_style_qualification_for_event = false:error \ No newline at end of file +dotnet_style_qualification_for_event = false:error diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 0473985..8c7acc5 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,9 +1,7 @@ -# This workflow will build a .NET project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net - name: .NET on: + workflow_dispatch: push: branches: [ "main" ] pull_request: @@ -11,25 +9,62 @@ on: jobs: build: + name: Build and analyze + runs-on: windows-latest + env: + ProjectName: 'AStar.Dev.Api.Client.Sdk.Shared' + RepositoryName: 'astar-dev-api-client-sdk-shared' + steps: + - name: Set up JDK + uses: actions/setup-java@v4.4.0 + with: + java-version: 17 + distribution: 'zulu' - runs-on: ubuntu-latest + - name: Checkout + uses: actions/checkout@v4.2.1 + with: + fetch-depth: 0 + + - name: Cache SonarCloud packages + uses: actions/cache@v4.2.3 + with: + path: ~\sonar\cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + + - name: Cache SonarCloud scanner + id: cache-sonar-scanner + uses: actions/cache@v4.2.3 + with: + path: .\.sonar\scanner + key: ${{ runner.os }}-sonar-scanner + restore-keys: ${{ runner.os }}-sonar-scanner + + - name: Install SonarCloud scanner + if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' + shell: powershell + run: | + New-Item -Path .\.sonar\scanner -ItemType Directory + dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner + + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + shell: powershell + run: | + dotnet tool install --global dotnet-coverage + .\.sonar\scanner\dotnet-sonarscanner begin /k:"astar-development_${{ env.RepositoryName }}" /o:"astar-development" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml + dotnet build --configuration Release + dotnet-coverage collect 'dotnet test --filter "FullyQualifiedName!~Acceptance.Tests"' -f xml -o 'coverage.xml' + .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" + + - name: Pack NuGet package + if: github.ref == 'refs/heads/main' + run: dotnet pack .\src\${{ env.ProjectName }}\${{ env.ProjectName }}.csproj + + - name: Push to NuGet + if: github.ref == 'refs/heads/main' + run: dotnet nuget push "**\${{ env.ProjectName }}.*.nupkg" --api-key ${{secrets.nuget_api_key}} --skip-duplicate --source https://api.nuget.org/v3/index.json - steps: - - uses: actions/checkout@v4 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 9.0.x - - - name: Delete nuget*.config files - run: rm -f nuget*.config - - - name: Restore dependencies - run: dotnet restore - - - name: Build - run: dotnet build --no-restore - - - name: Test - run: dotnet test --no-build --verbosity normal diff --git a/.gitignore b/.gitignore index a4fe18b..dfcfd56 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## -## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore # User-specific files *.rsuser @@ -23,7 +23,6 @@ mono_crash.* [Rr]eleases/ x64/ x86/ -[Ww][Ii][Nn]32/ [Aa][Rr][Mm]/ [Aa][Rr][Mm]64/ bld/ @@ -62,9 +61,6 @@ project.lock.json project.fragment.lock.json artifacts/ -# ASP.NET Scaffolding -ScaffoldingReadMe.txt - # StyleCop StyleCopReport.xml @@ -82,8 +78,6 @@ StyleCopReport.xml *.pgc *.pgd *.rsp -# but not Directory.Build.rsp, as it configures directory-level build defaults -!Directory.Build.rsp *.sbr *.tlb *.tli @@ -92,7 +86,6 @@ StyleCopReport.xml *.tmp_proj *_wpftmp.csproj *.log -*.tlog *.vspscc *.vssscc .builds @@ -144,11 +137,6 @@ _TeamCity* .axoCover/* !.axoCover/settings.json -# Coverlet is a free, cross platform Code Coverage Tool -coverage*.json -coverage*.xml -coverage*.info - # Visual Studio code coverage results *.coverage *.coveragexml @@ -296,17 +284,6 @@ node_modules/ # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) *.vbw -# Visual Studio 6 auto-generated project file (contains which files were open etc.) -*.vbp - -# Visual Studio 6 workspace and project file (working project files containing files to include in project) -*.dsw -*.dsp - -# Visual Studio 6 technical files -*.ncb -*.aps - # Visual Studio LightSwitch build output **/*.HTMLClient/GeneratedArtifacts **/*.DesktopClient/GeneratedArtifacts @@ -363,9 +340,6 @@ ASALocalRun/ # Local History for Visual Studio .localhistory/ -# Visual Studio History (VSHistory) files -.vshistory/ - # BeatPulse healthcheck temp database healthchecksdb @@ -374,27 +348,3 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ - -# Fody - auto-generated XML schema -FodyWeavers.xsd - -# VS Code files for those working on multiple tools -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -*.code-workspace - -# Local History for Visual Studio Code -.history/ - -# Windows Installer files from build outputs -*.cab -*.msi -*.msix -*.msm -*.msp - -# JetBrains Rider -*.sln.iml diff --git a/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/.gitignore b/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/.gitignore new file mode 100644 index 0000000..7a03d60 --- /dev/null +++ b/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/.idea.AStar.Dev.Api.Client.Sdk.Shared.iml +/contentModel.xml +/projectSettingsUpdater.xml +/modules.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/.name b/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/.name new file mode 100644 index 0000000..90ddc1c --- /dev/null +++ b/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/.name @@ -0,0 +1 @@ +AStar.Dev.Api.Client.Sdk.Shared \ No newline at end of file diff --git a/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/indexLayout.xml b/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/vcs.xml b/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/AStar.Dev.Api.Client.Sdk.Shared.sln b/AStar.Dev.Api.Client.Sdk.Shared.sln new file mode 100644 index 0000000..d153135 --- /dev/null +++ b/AStar.Dev.Api.Client.Sdk.Shared.sln @@ -0,0 +1,52 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{92CD35A9-E04F-435D-8049-9479A49A4E3A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{C08B6FBA-54C5-4A0E-BF57-91B13304DC08}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AStar.Dev.Api.Client.Sdk.Shared", "src\AStar.Dev.Api.Client.Sdk.Shared\AStar.Dev.Api.Client.Sdk.Shared.csproj", "{F6CB8CAB-AE3F-48F7-9DA5-77830D77A085}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit", "test\AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit\AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit.csproj", "{DAB06894-014F-44E9-B5D3-9BB08DC9F0EF}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{67DA8F1D-3A94-402B-A849-6FFD9F32CA60}" + ProjectSection(SolutionItems) = preProject + .github\dependabot.yml = .github\dependabot.yml + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{0BE9B040-6CE1-43DA-8B35-F35C4E90098E}" + ProjectSection(SolutionItems) = preProject + .github\workflows\dotnet.yml = .github\workflows\dotnet.yml + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8B31BBC4-D482-405D-8477-31E3F774D7C8}" + ProjectSection(SolutionItems) = preProject + AStar.png = AStar.png + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {F6CB8CAB-AE3F-48F7-9DA5-77830D77A085} = {92CD35A9-E04F-435D-8049-9479A49A4E3A} + {DAB06894-014F-44E9-B5D3-9BB08DC9F0EF} = {C08B6FBA-54C5-4A0E-BF57-91B13304DC08} + {0BE9B040-6CE1-43DA-8B35-F35C4E90098E} = {67DA8F1D-3A94-402B-A849-6FFD9F32CA60} + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F6CB8CAB-AE3F-48F7-9DA5-77830D77A085}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6CB8CAB-AE3F-48F7-9DA5-77830D77A085}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6CB8CAB-AE3F-48F7-9DA5-77830D77A085}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6CB8CAB-AE3F-48F7-9DA5-77830D77A085}.Release|Any CPU.Build.0 = Release|Any CPU + {DAB06894-014F-44E9-B5D3-9BB08DC9F0EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DAB06894-014F-44E9-B5D3-9BB08DC9F0EF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DAB06894-014F-44E9-B5D3-9BB08DC9F0EF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DAB06894-014F-44E9-B5D3-9BB08DC9F0EF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/AStar.Dev.Example.sln.sln b/AStar.Dev.Example.sln.sln deleted file mode 100644 index be68fef..0000000 --- a/AStar.Dev.Example.sln.sln +++ /dev/null @@ -1,57 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31903.59 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ADD5430F-CD80-42C7-80DA-90048E210EE7}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{73794993-9898-4968-AF19-C3E7450C94E4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AStar.Dev.Example.ClassLib", "src\AStar.Dev.Example.ClassLib\AStar.Dev.Example.ClassLib.csproj", "{A9C19332-40FE-4E24-A890-405D46CD72A5}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "end-to-end", "end-to-end", "{F1C7FB9E-2F0F-41C9-822A-7320339193CA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "integration", "integration", "{D724595D-C6BC-4F31-9D2A-4F4707436F10}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unit", "unit", "{10DD984D-6788-4E04-A89C-3270006F5C56}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AStar.Dev.Example.ClassLib.Tests.Unit", "test\unit\AStar.Dev.Example.ClassLib.Tests.Unit\AStar.Dev.Example.ClassLib.Tests.Unit.csproj", "{1D7D41F6-3866-4C00-A1BA-1675227FA9FA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E1CEEE40-22D0-4F7B-AB2B-A308F8DE6A54}" - ProjectSection(SolutionItems) = preProject - .editorconfig = .editorconfig - .gitignore = .gitignore - build-and-test.ps1 = build-and-test.ps1 - CodeMaid.config = CodeMaid.config - LICENSE = LICENSE - nuget.ci.config = nuget.ci.config - nuget.config = nuget.config - README.md = README.md - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A9C19332-40FE-4E24-A890-405D46CD72A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A9C19332-40FE-4E24-A890-405D46CD72A5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A9C19332-40FE-4E24-A890-405D46CD72A5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A9C19332-40FE-4E24-A890-405D46CD72A5}.Release|Any CPU.Build.0 = Release|Any CPU - {1D7D41F6-3866-4C00-A1BA-1675227FA9FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1D7D41F6-3866-4C00-A1BA-1675227FA9FA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1D7D41F6-3866-4C00-A1BA-1675227FA9FA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1D7D41F6-3866-4C00-A1BA-1675227FA9FA}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {A9C19332-40FE-4E24-A890-405D46CD72A5} = {ADD5430F-CD80-42C7-80DA-90048E210EE7} - {F1C7FB9E-2F0F-41C9-822A-7320339193CA} = {73794993-9898-4968-AF19-C3E7450C94E4} - {D724595D-C6BC-4F31-9D2A-4F4707436F10} = {73794993-9898-4968-AF19-C3E7450C94E4} - {10DD984D-6788-4E04-A89C-3270006F5C56} = {73794993-9898-4968-AF19-C3E7450C94E4} - {1D7D41F6-3866-4C00-A1BA-1675227FA9FA} = {10DD984D-6788-4E04-A89C-3270006F5C56} - EndGlobalSection -EndGlobal diff --git a/AStar.png b/AStar.png new file mode 100644 index 0000000..8cac0a1 Binary files /dev/null and b/AStar.png differ diff --git a/CodeMaid.config b/CodeMaid.config deleted file mode 100644 index 54f2ebe..0000000 --- a/CodeMaid.config +++ /dev/null @@ -1,82 +0,0 @@ - - - - -
- - - - - - <?xml version="1.0" encoding="utf-16"?> - <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <string>ReSharper disable </string> - <string>ReSharper enable </string> - </ArrayOfString> - - - - True - - - 1 - - - False - - - True - - - True - - - 1 - - - 2 - - - True - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - True - - - 1 - - - - \ No newline at end of file diff --git a/nuget.ci.config b/nuget.ci.config deleted file mode 100644 index aa5beec..0000000 --- a/nuget.ci.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/nuget.config b/nuget.config deleted file mode 100644 index 782724b..0000000 --- a/nuget.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/AStar.Dev.Api.Client.Sdk.Shared/AStar.Dev.Api.Client.Sdk.Shared.csproj b/src/AStar.Dev.Api.Client.Sdk.Shared/AStar.Dev.Api.Client.Sdk.Shared.csproj new file mode 100644 index 0000000..eaf3901 --- /dev/null +++ b/src/AStar.Dev.Api.Client.Sdk.Shared/AStar.Dev.Api.Client.Sdk.Shared.csproj @@ -0,0 +1,59 @@ + + + + latest-recommended + AStar Developement, Jason Barden + AStar Development + AStar Developement, 2025 + + This package contains classes that are shared across the various Client SDKs. + + It is not intended to be consumed on its own. + + $(AssemblyName).xml + True + True + true + enable + True + true + enable + AStar.png + LICENSE + https://github.com/astar-development/astar-dev-api-client-sdk-shared/ + Readme.md + Initial version. + True + git + https://github.com/astar-development/astar-dev-api-client-sdk-shared/ + snupkg + net9.0 + AStar.Dev.Api.Client.Sdk.Shared + 5b2a14cf-7e6b-4012-babe-f57facd457d2 + 0.1.0 + + + + + + + + + + + + + + + + + True + 1701;1702; + + + + True + 1701;1702; + + + diff --git a/src/AStar.Dev.Api.Client.Sdk.Shared/AStar.Dev.Api.Client.Sdk.Shared.xml b/src/AStar.Dev.Api.Client.Sdk.Shared/AStar.Dev.Api.Client.Sdk.Shared.xml new file mode 100644 index 0000000..a355700 --- /dev/null +++ b/src/AStar.Dev.Api.Client.Sdk.Shared/AStar.Dev.Api.Client.Sdk.Shared.xml @@ -0,0 +1,37 @@ + + + + AStar.Dev.Api.Client.Sdk.Shared + + + + + + + + + + + + + + + + + Defines the + + interface + + + + + Gets or sets the Base URL for the API + + + + + Gets or sets the Scopes for the API + + + + diff --git a/src/AStar.Dev.Api.Client.Sdk.Shared/AddApiHttpClient.cs b/src/AStar.Dev.Api.Client.Sdk.Shared/AddApiHttpClient.cs new file mode 100644 index 0000000..3a0e977 --- /dev/null +++ b/src/AStar.Dev.Api.Client.Sdk.Shared/AddApiHttpClient.cs @@ -0,0 +1,53 @@ +using System.Net; +using System.Net.Mime; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Http.Resilience; +using Microsoft.Extensions.Options; +using Microsoft.Identity.Web; +using Polly; + +#pragma warning disable CA1716 +namespace AStar.Dev.Api.Client.Sdk.Shared; +#pragma warning restore CA1716 + +/// +/// +public static class AddApiHttpClient +{ + /// + /// + /// + /// + /// + /// + public static void AddApiClient(this IServiceCollection services, string[] scopes) + where TApiClient : class + where TApiConfiguration : class, IApiConfiguration + { + var optionsScopes = string.Join(" ", scopes); + + _ = services.AddHttpClient() + .AddMicrosoftIdentityUserAuthenticationHandler( + nameof(TApiClient), + options => options.Scopes = optionsScopes) + .ConfigureHttpClient((serviceProvider, client) => + { + client.BaseAddress = serviceProvider.GetRequiredService>().Value + .BaseUrl; + + client.DefaultRequestHeaders.Accept.Add(new(MediaTypeNames.Application.Json)); + }) + .AddResilienceHandler($"{nameof(TApiClient)}Handler", + b => b.AddFallback(new() + { + FallbackAction = _ => Outcome.FromResultAsValueTask( + new + HttpResponseMessage(HttpStatusCode + .ServiceUnavailable)) + }) + .AddConcurrencyLimiter(100) + .AddRetry(new HttpRetryStrategyOptions()) + .AddCircuitBreaker(new HttpCircuitBreakerStrategyOptions()) + .AddTimeout(new HttpTimeoutStrategyOptions())); + } +} \ No newline at end of file diff --git a/src/AStar.Dev.Api.Client.Sdk.Shared/IApiConfiguration.cs b/src/AStar.Dev.Api.Client.Sdk.Shared/IApiConfiguration.cs new file mode 100644 index 0000000..1f219ed --- /dev/null +++ b/src/AStar.Dev.Api.Client.Sdk.Shared/IApiConfiguration.cs @@ -0,0 +1,17 @@ +namespace AStar.Dev.Api.Client.Sdk.Shared; + +/// +/// Defines the interface +/// +public interface IApiConfiguration +{ + /// + /// Gets or sets the Base URL for the API + /// + Uri BaseUrl { get; set; } + + /// + /// Gets or sets the Scopes for the API + /// + string[] Scopes { get; set; } +} \ No newline at end of file diff --git a/src/AStar.Dev.Example.ClassLib/AStar.Dev.Example.ClassLib.csproj b/src/AStar.Dev.Example.ClassLib/AStar.Dev.Example.ClassLib.csproj deleted file mode 100644 index 125f4c9..0000000 --- a/src/AStar.Dev.Example.ClassLib/AStar.Dev.Example.ClassLib.csproj +++ /dev/null @@ -1,9 +0,0 @@ - - - - net9.0 - enable - enable - - - diff --git a/src/AStar.Dev.Example.ClassLib/Class1.cs b/src/AStar.Dev.Example.ClassLib/Class1.cs deleted file mode 100644 index 27e9361..0000000 --- a/src/AStar.Dev.Example.ClassLib/Class1.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace AStar.Dev.Example.ClassLib; - -public class Class1 -{ - -} diff --git a/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit.csproj b/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit.csproj new file mode 100644 index 0000000..ea66800 --- /dev/null +++ b/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit.csproj @@ -0,0 +1,30 @@ + + + + net9.0 + enable + enable + false + True + latest-recommended + + + + + + + + + + + + + + + + + + + + + diff --git a/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/AddApiHttpClientShould.cs b/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/AddApiHttpClientShould.cs new file mode 100644 index 0000000..bbc53da --- /dev/null +++ b/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/AddApiHttpClientShould.cs @@ -0,0 +1,21 @@ +using JetBrains.Annotations; +using Microsoft.Extensions.DependencyInjection; + +#pragma warning disable CA1716 +namespace AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit; +#pragma warning restore CA1716 + +[TestSubject(typeof(AddApiHttpClient))] +public class AddApiHttpClientShould +{ + [Fact] + public void IncludeTheAddApiHttpClientMethod() + { + var sut = new ServiceCollection(); + var initialServiceCount = sut.Count; + + sut.AddApiClient(["Scope Does Not Matter Here"]); + + sut.Count.ShouldBe(initialServiceCount + 44); + } +} \ No newline at end of file diff --git a/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/MockApiClient.cs b/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/MockApiClient.cs new file mode 100644 index 0000000..efbb9f4 --- /dev/null +++ b/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/MockApiClient.cs @@ -0,0 +1,5 @@ +namespace AStar.Dev.Api.Client.Sdk.Shared.Tests; + +internal sealed class MockApiClient +{ +} \ No newline at end of file diff --git a/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/MockApiConfiguration.cs b/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/MockApiConfiguration.cs new file mode 100644 index 0000000..493b44f --- /dev/null +++ b/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/MockApiConfiguration.cs @@ -0,0 +1,10 @@ +namespace AStar.Dev.Api.Client.Sdk.Shared.Tests; + +internal sealed class MockApiConfiguration : IApiConfiguration +{ + /// + public Uri BaseUrl { get; set; } = new ("https://not.set.com"); + + /// + public string[] Scopes { get; set; } = []; +} \ No newline at end of file diff --git a/test/unit/AStar.Dev.Example.ClassLib.Tests.Unit/AStar.Dev.Example.ClassLib.Tests.Unit.csproj b/test/unit/AStar.Dev.Example.ClassLib.Tests.Unit/AStar.Dev.Example.ClassLib.Tests.Unit.csproj deleted file mode 100644 index 6fbda4a..0000000 --- a/test/unit/AStar.Dev.Example.ClassLib.Tests.Unit/AStar.Dev.Example.ClassLib.Tests.Unit.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - net9.0 - enable - enable - false - - - - - - - - - - - - - - - - - - diff --git a/test/unit/AStar.Dev.Example.ClassLib.Tests.Unit/UnitTest1.cs b/test/unit/AStar.Dev.Example.ClassLib.Tests.Unit/UnitTest1.cs deleted file mode 100644 index 3928e91..0000000 --- a/test/unit/AStar.Dev.Example.ClassLib.Tests.Unit/UnitTest1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace AStar.Dev.Example.ClassLib.Tests.Unit; - -public class UnitTest1 -{ - [Fact] - public void Test1() - { - - } -}