Skip to content

Commit b5de686

Browse files
authored
Add .net 5 rc-1 support (#212)
1 parent 4c21714 commit b5de686

File tree

21 files changed

+82
-72
lines changed

21 files changed

+82
-72
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
dotnet-version: '3.1.x'
3636
- uses: actions/setup-dotnet@v1
3737
with:
38-
dotnet-version: '5.0.100-preview.8.20417.9'
38+
dotnet-version: '5.0.100-rc.1.20452.10'
3939
- name: DOTNET HACK
4040
shell: pwsh
4141
run: |

.github/workflows/main.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
dotnet-version: '3.1.x'
4040
- uses: actions/setup-dotnet@v1
4141
with:
42-
dotnet-version: '5.0.100-preview.8.20417.9'
42+
dotnet-version: '5.0.100-rc.1.20452.10'
4343
- name: Move .net SDK's to shared folder (hack)
4444
shell: pwsh
4545
run: |
@@ -70,7 +70,7 @@ jobs:
7070
dotnet-version: '3.1.x'
7171
- uses: actions/setup-dotnet@v1
7272
with:
73-
dotnet-version: '5.0.100-preview.8.20417.9'
73+
dotnet-version: '5.0.100-rc.1.20452.10'
7474
- name: Move .net SDK's to shared folder (hack)
7575
shell: pwsh
7676
run: |
@@ -85,7 +85,9 @@ jobs:
8585
}
8686
8787
- name: Running unit tests
88-
run: dotnet test -c Debug /nowarn:CS1591 /p:CollectCoverage=true /p:CoverletOutput=./coverage/ /p:CoverletOutputFormat=opencover /p:ExcludeByAttribute=\"Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute\" /p:UseSourceLink=true
88+
run: |
89+
dotnet build -c Debug /nowarn:CS1591 /p:UseSourceLink=true
90+
dotnet test -c Debug --no-build /nowarn:CS1591 /p:CollectCoverage=true /p:CoverletOutput=./coverage/ /p:CoverletOutputFormat=opencover /p:ExcludeByAttribute=\"Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute\" /p:UseSourceLink=true
8991
9092
- name: Upload coverage to Codecov
9193
uses: codecov/codecov-action@v1
@@ -121,7 +123,7 @@ jobs:
121123
dotnet-version: '3.1.x'
122124
- uses: actions/setup-dotnet@v1
123125
with:
124-
dotnet-version: '5.0.100-preview.8.20417.9'
126+
dotnet-version: '5.0.100-rc.1.20452.10'
125127
- name: Move .net SDK's to shared folder (hack)
126128
shell: pwsh
127129
run: |
@@ -137,6 +139,7 @@ jobs:
137139
138140
- name: Creating library package
139141
run: |
142+
dotnet restore
140143
dotnet pack src/bunit.core/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true
141144
dotnet pack src/bunit.web/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true
142145
dotnet pack src/bunit.xunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true
@@ -165,7 +168,7 @@ jobs:
165168
dotnet-version: '3.1.x'
166169
- uses: actions/setup-dotnet@v1
167170
with:
168-
dotnet-version: '5.0.100-preview.8.20417.9'
171+
dotnet-version: '5.0.100-rc.1.20452.10'
169172
- name: Move .net SDK's to shared folder (hack)
170173
shell: pwsh
171174
run: |
@@ -234,7 +237,7 @@ jobs:
234237
dotnet-version: '3.1.x'
235238
- uses: actions/setup-dotnet@v1
236239
with:
237-
dotnet-version: '5.0.100-preview.8.20417.9'
240+
dotnet-version: '5.0.100-rc.1.20452.10'
238241
- name: Move .net SDK's to shared folder (hack)
239242
shell: pwsh
240243
run: |
@@ -292,7 +295,7 @@ jobs:
292295
dotnet-version: '3.1.x'
293296
- uses: actions/setup-dotnet@v1
294297
with:
295-
dotnet-version: '5.0.100-preview.8.20417.9'
298+
dotnet-version: '5.0.100-rc.1.20452.10'
296299
- name: DOTNET HACK
297300
shell: pwsh
298301
run: |

docs/samples/components/bunit.docs.samples.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
</ItemGroup>
1616

1717
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
18-
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0-preview.8.*" />
19-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0-preview.8.*" />
20-
<PackageReference Include="Microsoft.AspNetCore.Components" Version="5.0.0-preview.8.*" />
21-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.0-preview.8.*" />
22-
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="5.0.0-preview.8.*" />
18+
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0-rc.1.*" />
19+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0-rc.1.*" />
20+
<PackageReference Include="Microsoft.AspNetCore.Components" Version="5.0.0-rc.1.*" />
21+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.0-rc.1.*" />
22+
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="5.0.0-rc.1.*" />
2323
</ItemGroup>
2424

2525
</Project>

docs/samples/tests/Directory.Build.props

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
44
<IsPackable>false</IsPackable>
55
<LangVersion>8.0</LangVersion>
6-
<RazorLangVersion>3.0</RazorLangVersion>
6+
<RazorLangVersion>3.0</RazorLangVersion>
77
</PropertyGroup>
8-
98
</Project>

src/Directory.Build.props

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,39 @@
1212
<PublishRepositoryUrl>true</PublishRepositoryUrl>
1313
<EmbedUntrackedSources>true</EmbedUntrackedSources>
1414
<IncludeSymbols>true</IncludeSymbols>
15+
<DebugType>embedded</DebugType>
1516
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1617
</PropertyGroup>
1718

18-
<PropertyGroup Condition="$(MSBuildProjectName)!='bunit.template' AND $(MSBuildProjectName)!='bunit'">
19+
<PropertyGroup Condition="$(MSBuildProjectName) != 'bunit.template' AND $(MSBuildProjectName) != 'bunit'">
1920
<TargetFrameworks>netstandard2.1;net5.0</TargetFrameworks>
2021
<LangVersion>8.0</LangVersion>
2122
<Nullable>enable</Nullable>
2223
<WarningsAsErrors>CS8600;CS8602;CS8603;CS8625</WarningsAsErrors>
2324
<Deterministic>true</Deterministic>
2425
</PropertyGroup>
2526

26-
<PropertyGroup Condition="'$(Configuration)' == 'Release' AND $(MSBuildProjectName)!='bunit.template' AND $(MSBuildProjectName)!='bunit'">
27+
<PropertyGroup Condition="'$(Configuration)' == 'Release' AND $(MSBuildProjectName) != 'bunit.template' AND $(MSBuildProjectName) != 'bunit'">
2728
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2829
</PropertyGroup>
2930

30-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1' AND $(MSBuildProjectName)!='bunit.template' AND $(MSBuildProjectName)!='bunit'">
31+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1' AND $(MSBuildProjectName) != 'bunit.template' AND $(MSBuildProjectName) != 'bunit'">
3132
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="3.1.1" />
3233
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.1" />
3334
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.1" />
3435
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.1.1" />
3536
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.1" />
3637
</ItemGroup>
3738

38-
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0' AND $(MSBuildProjectName)!='bunit.template' AND $(MSBuildProjectName)!='bunit'">
39-
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="5.0.0-preview.8.*" />
40-
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0-preview.8.*" />
41-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0-preview.8.*" />
42-
<PackageReference Include="Microsoft.AspNetCore.Components" Version="5.0.0-preview.8.*" />
43-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.0-preview.8.*" />
39+
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0' AND $(MSBuildProjectName) != 'bunit.template' AND $(MSBuildProjectName) != 'bunit'">
40+
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="5.0.0-rc.1.*" />
41+
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0-rc.1.*" />
42+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0-rc.1.*" />
43+
<PackageReference Include="Microsoft.AspNetCore.Components" Version="5.0.0-rc.1.*" />
44+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.0-rc.1.*" />
4445
</ItemGroup>
4546

46-
<ItemGroup Condition="$(MSBuildProjectName)!='bunit.template' AND $(MSBuildProjectName)!='bunit'">
47+
<ItemGroup Condition="$(MSBuildProjectName) != 'bunit.template' AND $(MSBuildProjectName) != 'bunit'">
4748
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
4849
<PrivateAssets>all</PrivateAssets>
4950
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

src/bunit.core/Extensions/EnumerableExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections;
23
using System.Collections.Generic;
34
using System.Diagnostics.CodeAnalysis;
45
using System.Linq;

src/bunit.web/Extensions/RenderedFragmentExtensions.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4-
54
using AngleSharp.Dom;
6-
75
using AngleSharpWrappers;
8-
6+
using Bunit.Extensions;
97
using Bunit.Rendering;
10-
118
using Microsoft.AspNetCore.Components;
129
using Microsoft.Extensions.DependencyInjection;
1310

@@ -81,7 +78,7 @@ public static IReadOnlyList<IRenderedComponent<TComponent>> FindComponents<TComp
8178
var renderer = renderedFragment.Services.GetRequiredService<ITestRenderer>();
8279
var components = renderer.FindComponents<TComponent>(renderedFragment);
8380

84-
return components.Cast<IRenderedComponent<TComponent>>().ToArray();
81+
return components.OfType<IRenderedComponent<TComponent>>().ToArray();
8582
}
8683
}
8784
}

src/bunit.web/TestDoubles/JSInterop/JSRuntimeInvocation.cs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ namespace Bunit.TestDoubles.JSInterop
2424
/// <summary>
2525
/// Gets the arguments used in the invocation.
2626
/// </summary>
27-
public IReadOnlyList<object> Arguments { get; }
27+
public IReadOnlyList<object?> Arguments { get; }
2828

2929

3030
/// <summary>
3131
/// Creates an instance of the <see cref="JSRuntimeInvocation"/>.
3232
/// </summary>
33-
public JSRuntimeInvocation(string identifier, CancellationToken cancellationToken, object[] args)
33+
public JSRuntimeInvocation(string identifier, CancellationToken cancellationToken, object?[]? args)
3434
{
3535
Identifier = identifier;
3636
CancellationToken = cancellationToken;
37-
Arguments = args;
37+
Arguments = args ?? Array.Empty<object?>();
3838
}
3939

4040
/// <inheritdoc/>
@@ -67,15 +67,26 @@ public override int GetHashCode()
6767
/// <inheritdoc/>
6868
public static bool operator !=(JSRuntimeInvocation left, JSRuntimeInvocation right) => !(left == right);
6969

70-
private static bool ArgumentsEqual(IReadOnlyList<object> left, IReadOnlyList<object> right)
70+
private static bool ArgumentsEqual(IReadOnlyList<object?> left, IReadOnlyList<object?> right)
7171
{
7272
if (left.Count != right.Count)
7373
return false;
7474

7575
for (var i = 0; i < left.Count; i++)
7676
{
77-
if (!left[i].Equals(right[i]))
78-
return false;
77+
var l = left[i];
78+
var r = right[i];
79+
80+
if (l is null)
81+
{
82+
if (r is object)
83+
return false;
84+
}
85+
else
86+
{
87+
if (!l.Equals(right[i]))
88+
return false;
89+
}
7990
}
8091

8192
return true;

src/bunit.web/TestDoubles/JSInterop/JSRuntimePlannedInvocation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Bunit.TestDoubles.JSInterop
88
/// </summary>
99
public class JSRuntimePlannedInvocation : JSRuntimePlannedInvocationBase<object>
1010
{
11-
internal JSRuntimePlannedInvocation(string identifier, Func<IReadOnlyList<object>, bool> matcher) : base(identifier, matcher)
11+
internal JSRuntimePlannedInvocation(string identifier, Func<IReadOnlyList<object?>, bool> matcher) : base(identifier, matcher)
1212
{
1313
}
1414

@@ -27,7 +27,7 @@ public void SetVoidResult()
2727
/// <typeparam name="TResult"></typeparam>
2828
public class JSRuntimePlannedInvocation<TResult> : JSRuntimePlannedInvocationBase<TResult>
2929
{
30-
internal JSRuntimePlannedInvocation(string identifier, Func<IReadOnlyList<object>, bool> matcher) : base(identifier, matcher)
30+
internal JSRuntimePlannedInvocation(string identifier, Func<IReadOnlyList<object?>, bool> matcher) : base(identifier, matcher)
3131
{
3232
}
3333

src/bunit.web/TestDoubles/JSInterop/JSRuntimePlannedInvocationBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public abstract class JSRuntimePlannedInvocationBase<TResult>
1212
{
1313
private readonly List<JSRuntimeInvocation> _invocations;
1414

15-
private Func<IReadOnlyList<object>, bool> InvocationMatcher { get; }
15+
private Func<IReadOnlyList<object?>, bool> InvocationMatcher { get; }
1616

1717
private TaskCompletionSource<TResult> _completionSource;
1818

@@ -29,7 +29,7 @@ public abstract class JSRuntimePlannedInvocationBase<TResult>
2929
/// <summary>
3030
/// Creates an instance of a <see cref="JSRuntimePlannedInvocationBase{TResult}"/>.
3131
/// </summary>
32-
protected JSRuntimePlannedInvocationBase(string identifier, Func<IReadOnlyList<object>, bool> matcher)
32+
protected JSRuntimePlannedInvocationBase(string identifier, Func<IReadOnlyList<object?>, bool> matcher)
3333
{
3434
Identifier = identifier;
3535
_invocations = new List<JSRuntimeInvocation>();

0 commit comments

Comments
 (0)