Skip to content

Commit

Permalink
Switch to the latest 6.0.x NET SDK and fix compiler issues (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
sungam3r authored Nov 6, 2022
1 parent 8b55047 commit 838f74c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup .NET Core SDK
uses: actions/[email protected]
with:
dotnet-version: '6.0.102'
dotnet-version: 6.0.x

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Setup .NET Core 6.0 SDK
- name: Setup .NET Core SDK
uses: actions/[email protected]
with:
dotnet-version: '6.0.x'
dotnet-version: 6.0.x
source-url: https://nuget.pkg.github.com/sungam3r/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
version="${github_ref:10}"
echo version=$version
echo "version=$version" >> $GITHUB_ENV
- name: Setup .NET Core 6.0 SDK
- name: Setup .NET Core SDK
uses: actions/[email protected]
with:
dotnet-version: '6.0.x'
dotnet-version: 6.0.x
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.NUGET_API_KEY}}
Expand Down
9 changes: 6 additions & 3 deletions src/SteroidsDI.Tests/Cases/ScopedTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,20 @@ public ScopedTestBase()
// override this method to specify required services for unit tests
protected virtual void ConfigureServices(IServiceCollection services)
{
services.AddDefer();
services.AddGenericScope(GetType()); // GetType instead of <ScopedTestBase> to do not mix the same scope in case of parallel tests
_ = services
.AddDefer()
.AddGenericScope(GetType()); // GetType instead of <ScopedTestBase> to do not mix the same scope in case of parallel tests
}

protected T? GetService<T>() => ((IServiceScope)_scoped.Scope).ServiceProvider.GetService<T>();

protected T GetRequiredService<T>() => ((IServiceScope)_scoped.Scope).ServiceProvider.GetRequiredService<T>();
protected T GetRequiredService<T>() where T : notnull
=> ((IServiceScope)_scoped.Scope).ServiceProvider.GetRequiredService<T>();

public void Dispose()
{
_scoped.Dispose();
_rootProvider.Dispose();
GC.SuppressFinalize(this);
}
}

0 comments on commit 838f74c

Please sign in to comment.