Skip to content

Commit 2891c81

Browse files
authored
Merge pull request #1240 from bUnit-dev/release/v1.24
Release of new minor version v1.24
2 parents 3142159 + 9da72c5 commit 2891c81

File tree

74 files changed

+719
-2757
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+719
-2757
lines changed

.github/workflows/docs-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030

3131
- name: ⚙️ Import GPG key
3232
id: import_gpg
33-
uses: crazy-max/ghaction-import-gpg@v5
33+
uses: crazy-max/ghaction-import-gpg@v6
3434
with:
3535
gpg_private_key: ${{ secrets.BUNIT_BOT_GPG_PRIVATE_KEY }}
3636
passphrase: ${{ secrets.BUNIT_BOT_GPG_KEY_PASSPHRASE }}
@@ -88,7 +88,7 @@ jobs:
8888
8989
- name: 🛠️ Deploy to GitHub Pages
9090
if: success()
91-
uses: crazy-max/ghaction-github-pages@v3
91+
uses: crazy-max/ghaction-github-pages@v4
9292
with:
9393
build_dir: docs/site/_site
9494
fqdn: bunit.dev

.github/workflows/prepare-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
exit 1
3636
- name: ⚙️ Import GPG key
3737
id: import_gpg
38-
uses: crazy-max/ghaction-import-gpg@v5
38+
uses: crazy-max/ghaction-import-gpg@v6
3939
with:
4040
gpg_private_key: ${{ secrets.BUNIT_BOT_GPG_PRIVATE_KEY }}
4141
passphrase: ${{ secrets.BUNIT_BOT_GPG_KEY_PASSPHRASE }}

.github/workflows/release-preview.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@ on:
77
types: [completed]
88
branches: [main, v2]
99

10-
workflow_dispatch:
11-
inputs:
12-
nugetRelease:
13-
description: 'Release to NuGet? Set to "true" to release to NuGet.org as well as GPR.'
14-
required: true
15-
default: 'true'
16-
1710
jobs:
1811
release-preview:
1912
if: github.event_name == 'workflow_dispatch' || (github.ref == 'refs/heads/main' && ${{ github.event.workflow_run.conclusion == 'success' }}) || (github.ref == 'refs/heads/v2' && ${{ github.event.workflow_run.conclusion == 'success' }})
@@ -58,5 +51,4 @@ jobs:
5851
run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/*.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/bunit-dev/index.json --skip-duplicate --no-symbols
5952

6053
- name: 🛠️ Upload library to NuGet.org repository
61-
if: github.event.inputs.nugetRelease == 'true'
6254
run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
4343
- name: ⚙️ Import GPG key
4444
id: import_gpg
45-
uses: crazy-max/ghaction-import-gpg@v5
45+
uses: crazy-max/ghaction-import-gpg@v6
4646
with:
4747
gpg_private_key: ${{ secrets.BUNIT_BOT_GPG_PRIVATE_KEY }}
4848
passphrase: ${{ secrets.BUNIT_BOT_GPG_KEY_PASSPHRASE }}

CHANGELOG.md

Lines changed: 214 additions & 203 deletions
Large diffs are not rendered by default.

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<PropertyGroup Label="Compile settings">
2121
<Nullable>enable</Nullable>
22-
<LangVersion>11.0</LangVersion>
22+
<LangVersion>preview</LangVersion>
2323
<AccelerateBuildsInVisualStudio>false</AccelerateBuildsInVisualStudio>
2424
<ImplicitUsings>enable</ImplicitUsings>
2525
<NoWarn>CA1014,NU5104,NETSDK1138,SYSLIB0051</NoWarn>
@@ -51,7 +51,7 @@
5151
<!-- Shared code analyzers used for all projects in the solution -->
5252
<ItemGroup Label="Code Analyzers">
5353
<PackageReference Include="AsyncFixer" Version="1.6.0" PrivateAssets="All" />
54-
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.9.0.77355" PrivateAssets="All" />
54+
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.12.0.78982" PrivateAssets="All" />
5555
</ItemGroup>
5656

5757
<ItemGroup Label="Implicit usings"

benchmark/bunit.benchmarks/bunit.benchmarks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="BenchmarkDotNet" Version="0.13.7" />
11+
<PackageReference Include="BenchmarkDotNet" Version="0.13.9" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

bunit.sln

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bunit.web.tests", "tests\bu
4646
EndProject
4747
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bunit.testassets", "tests\bunit.testassets\bunit.testassets.csproj", "{7972A80F-30DC-4EF4-9294-7D4DD2965882}"
4848
EndProject
49-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bunit.web.testcomponents", "src\bunit.web.testcomponents\bunit.web.testcomponents.csproj", "{F61B8A55-3B5B-45FB-8E38-DBF9296B35C7}"
50-
EndProject
51-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bunit.web.testcomponents.tests", "tests\bunit.web.testcomponents.tests\bunit.web.testcomponents.tests.csproj", "{4CAB561E-0AFF-4516-AB9B-981F94EF1E86}"
52-
EndProject
5349
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".workflows", ".workflows", "{3B2F3419-5336-4147-A212-E19091195203}"
5450
ProjectSection(SolutionItems) = preProject
5551
.github\workflows\docs-deploy.yml = .github\workflows\docs-deploy.yml
@@ -70,8 +66,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bunit.benchmarks.assets", "
7066
EndProject
7167
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AngleSharpWrappers", "src\AngleSharpWrappers\AngleSharpWrappers.csproj", "{ABB3F046-0297-491A-9106-7948403BE0DE}"
7268
EndProject
73-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AngleSharpWrappers.Tests", "tests\AngleSharpWrappers.Tests\AngleSharpWrappers.Tests.csproj", "{BE6B6206-E32F-4AFC-BAB4-AEC5E8A7F16B}"
74-
EndProject
7569
Global
7670
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7771
Debug|Any CPU = Debug|Any CPU
@@ -102,14 +96,6 @@ Global
10296
{7972A80F-30DC-4EF4-9294-7D4DD2965882}.Debug|Any CPU.Build.0 = Debug|Any CPU
10397
{7972A80F-30DC-4EF4-9294-7D4DD2965882}.Release|Any CPU.ActiveCfg = Release|Any CPU
10498
{7972A80F-30DC-4EF4-9294-7D4DD2965882}.Release|Any CPU.Build.0 = Release|Any CPU
105-
{F61B8A55-3B5B-45FB-8E38-DBF9296B35C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
106-
{F61B8A55-3B5B-45FB-8E38-DBF9296B35C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
107-
{F61B8A55-3B5B-45FB-8E38-DBF9296B35C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
108-
{F61B8A55-3B5B-45FB-8E38-DBF9296B35C7}.Release|Any CPU.Build.0 = Release|Any CPU
109-
{4CAB561E-0AFF-4516-AB9B-981F94EF1E86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
110-
{4CAB561E-0AFF-4516-AB9B-981F94EF1E86}.Debug|Any CPU.Build.0 = Debug|Any CPU
111-
{4CAB561E-0AFF-4516-AB9B-981F94EF1E86}.Release|Any CPU.ActiveCfg = Release|Any CPU
112-
{4CAB561E-0AFF-4516-AB9B-981F94EF1E86}.Release|Any CPU.Build.0 = Release|Any CPU
11399
{9F7A0623-8294-4A5D-946F-70C481732AA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
114100
{9F7A0623-8294-4A5D-946F-70C481732AA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
115101
{9F7A0623-8294-4A5D-946F-70C481732AA5}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -122,10 +108,6 @@ Global
122108
{ABB3F046-0297-491A-9106-7948403BE0DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
123109
{ABB3F046-0297-491A-9106-7948403BE0DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
124110
{ABB3F046-0297-491A-9106-7948403BE0DE}.Release|Any CPU.Build.0 = Release|Any CPU
125-
{BE6B6206-E32F-4AFC-BAB4-AEC5E8A7F16B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
126-
{BE6B6206-E32F-4AFC-BAB4-AEC5E8A7F16B}.Debug|Any CPU.Build.0 = Debug|Any CPU
127-
{BE6B6206-E32F-4AFC-BAB4-AEC5E8A7F16B}.Release|Any CPU.ActiveCfg = Release|Any CPU
128-
{BE6B6206-E32F-4AFC-BAB4-AEC5E8A7F16B}.Release|Any CPU.Build.0 = Release|Any CPU
129111
EndGlobalSection
130112
GlobalSection(SolutionProperties) = preSolution
131113
HideSolutionNode = FALSE
@@ -138,12 +120,9 @@ Global
138120
{6127D121-9387-451B-B15D-8350A32D3001} = {9A2B3B34-D41C-43E8-BC7D-246BEBE48D59}
139121
{FC122F63-8B22-4BAE-B96A-7AF3194CD204} = {6EA09ED4-B714-4E6F-B0E1-4D987F8AE520}
140122
{7972A80F-30DC-4EF4-9294-7D4DD2965882} = {6EA09ED4-B714-4E6F-B0E1-4D987F8AE520}
141-
{F61B8A55-3B5B-45FB-8E38-DBF9296B35C7} = {9A2B3B34-D41C-43E8-BC7D-246BEBE48D59}
142-
{4CAB561E-0AFF-4516-AB9B-981F94EF1E86} = {6EA09ED4-B714-4E6F-B0E1-4D987F8AE520}
143123
{9F7A0623-8294-4A5D-946F-70C481732AA5} = {F6084D31-2A92-4794-A47E-A8F2254E6970}
144124
{3619481F-DF6F-4399-9FED-450EE545A19E} = {F6084D31-2A92-4794-A47E-A8F2254E6970}
145125
{ABB3F046-0297-491A-9106-7948403BE0DE} = {9A2B3B34-D41C-43E8-BC7D-246BEBE48D59}
146-
{BE6B6206-E32F-4AFC-BAB4-AEC5E8A7F16B} = {6EA09ED4-B714-4E6F-B0E1-4D987F8AE520}
147126
EndGlobalSection
148127
GlobalSection(ExtensibilityGlobals) = postSolution
149128
SolutionGuid = {24106918-1C86-4769-BDA6-9C80E64CD260}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using Microsoft.Extensions.DependencyInjection;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Text;
5+
6+
namespace Bunit.Docs.Samples;
7+
8+
public sealed class CustomServiceProvider : IServiceProvider, IServiceScopeFactory, IServiceScope
9+
{
10+
private readonly IServiceProvider _serviceProvider;
11+
12+
public CustomServiceProvider(IServiceCollection serviceDescriptors)
13+
=> _serviceProvider = serviceDescriptors.BuildServiceProvider();
14+
15+
public object GetService(Type serviceType)
16+
{
17+
if (serviceType == typeof(IServiceScope) || serviceType == typeof(IServiceScopeFactory))
18+
return this;
19+
20+
if (serviceType == typeof(DummyService))
21+
return new DummyService();
22+
23+
return _serviceProvider.GetService(serviceType);
24+
}
25+
26+
void IDisposable.Dispose() { }
27+
public IServiceScope CreateScope() => this;
28+
IServiceProvider IServiceScope.ServiceProvider => this;
29+
}
30+
31+
public sealed class CustomServiceProviderFactoryContainerBuilder
32+
{
33+
private readonly IServiceCollection _serviceDescriptors;
34+
35+
public CustomServiceProviderFactoryContainerBuilder(IServiceCollection serviceDescriptors)
36+
=> this._serviceDescriptors = serviceDescriptors;
37+
38+
public IServiceProvider Build()
39+
=> new CustomServiceProvider(_serviceDescriptors);
40+
}
41+
42+
public sealed class CustomServiceProviderFactory : IServiceProviderFactory<CustomServiceProviderFactoryContainerBuilder>
43+
{
44+
public CustomServiceProviderFactoryContainerBuilder CreateBuilder(IServiceCollection services)
45+
=> new CustomServiceProviderFactoryContainerBuilder(services);
46+
47+
public IServiceProvider CreateServiceProvider(CustomServiceProviderFactoryContainerBuilder containerBuilder)
48+
=> containerBuilder.Build();
49+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
using Autofac;
2+
using Autofac.Extensions.DependencyInjection;
3+
using Microsoft.Extensions.DependencyInjection;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Text;
7+
using Xunit;
8+
9+
namespace Bunit.Docs.Samples;
10+
public class CustomServiceProviderFactoryUsage : TestContext
11+
{
12+
[Fact]
13+
public void CustomServiceProviderViaFactoryReturns()
14+
{
15+
Services.UseServiceProviderFactory(new CustomServiceProviderFactory());
16+
17+
var dummyService = Services.GetService<DummyService>();
18+
19+
Assert.NotNull(dummyService);
20+
}
21+
22+
[Fact]
23+
public void CustomServiceProviderViaDelegateReturns()
24+
{
25+
Services.UseServiceProviderFactory(x => new CustomServiceProvider(x));
26+
27+
var dummyService = Services.GetService<DummyService>();
28+
29+
Assert.NotNull(dummyService);
30+
}
31+
32+
[Fact]
33+
public void AutofacServiceProviderViaFactoryReturns()
34+
{
35+
void ConfigureContainer(ContainerBuilder containerBuilder)
36+
{
37+
containerBuilder
38+
.RegisterType<DummyService>()
39+
.AsSelf();
40+
}
41+
42+
Services.UseServiceProviderFactory(new AutofacServiceProviderFactory(ConfigureContainer));
43+
44+
//get a service which was installed in the Autofac ContainerBuilder
45+
46+
var dummyService = Services.GetService<DummyService>();
47+
48+
Assert.NotNull(dummyService);
49+
50+
//get a service which was installed in the bUnit ServiceCollection
51+
52+
var testContextBase = Services.GetService<TestContextBase>();
53+
54+
Assert.NotNull(testContextBase);
55+
Assert.Equal(this, testContextBase);
56+
}
57+
58+
[Fact]
59+
public void AutofacServiceProviderViaDelegateReturns()
60+
{
61+
ILifetimeScope ConfigureContainer(IServiceCollection services)
62+
{
63+
var containerBuilder = new ContainerBuilder();
64+
65+
containerBuilder
66+
.RegisterType<DummyService>()
67+
.AsSelf();
68+
69+
containerBuilder.Populate(services);
70+
71+
return containerBuilder.Build();
72+
}
73+
74+
Services.UseServiceProviderFactory(x => new AutofacServiceProvider(ConfigureContainer(x)));
75+
76+
//get a service which was installed in the Autofac ContainerBuilder
77+
78+
var dummyService = Services.GetService<DummyService>();
79+
80+
Assert.NotNull(dummyService);
81+
82+
//get a service which was installed in the bUnit ServiceCollection
83+
84+
var testContextBase = Services.GetService<TestContextBase>();
85+
86+
Assert.NotNull(testContextBase);
87+
Assert.Equal(this, testContextBase);
88+
}
89+
}

0 commit comments

Comments
 (0)