Skip to content

Commit 89fa586

Browse files
authored
Merge pull request #3 from fluentassertions/fix-awaits
Fix awaits
2 parents f54daa3 + 6c9d520 commit 89fa586

File tree

9 files changed

+105
-106
lines changed

9 files changed

+105
-106
lines changed

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,6 @@ dotnet_diagnostic.CA1309.severity = error
134134

135135
# Banned API Analyzers
136136
dotnet_diagnostic.RS0030.severity = error
137+
138+
# Configure await
139+
configure_await_analysis_mode = library

.github/workflows/branches.yml

+26-62
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,36 @@
11
name: Branch workflow
2-
on:
2+
on:
33
push:
4-
# branches-ignore:
5-
# - master
6-
# - 'release/**'
7-
# - 'releases/**'
4+
branches-ignore:
5+
- master
6+
- "release/**"
7+
- "releases/**"
8+
tags-ignore:
9+
- v*
10+
- V*
811
pull_request:
912
env:
10-
DOTNET_CLI_TELEMETRY_OPTOUT: true
13+
DOTNET_CLI_TELEMETRY_OPTOUT: true
1114
MSBUILDSINGLELOADCONTEXT: 1
1215
jobs:
13-
generateVersionInfo:
14-
name: GenerateVersionInfo
15-
runs-on: ubuntu-latest
16-
steps:
17-
- name: Checkout
18-
uses: actions/checkout@v2
19-
with:
20-
fetch-depth: 0
21-
- name: Restore dotnet tools
22-
run: dotnet tool restore
23-
- name: Fetch complete repository including tags
24-
run: git fetch --tags --force --prune
25-
- name: Generate version info from git history
26-
run: dotnet gitversion /output json | jq -r 'to_entries|map("GitVersion_\(.key)=\(.value|tostring)")|.[]' >> gitversion.env && cat gitversion.env
27-
- name: Upload version info file
28-
uses: actions/upload-artifact@v1
29-
with:
30-
name: gitversion
31-
path: gitversion.env
32-
3316
build:
3417
name: Build
35-
needs: generateVersionInfo
36-
runs-on: ubuntu-latest
37-
steps:
38-
- name: Checkout
39-
uses: actions/checkout@v2
40-
- name: Download version info file
41-
uses: actions/download-artifact@v1
42-
with:
43-
name: gitversion
44-
path: ./
45-
- name: Inject version info into environment
46-
run: cat ./gitversion.env >> $GITHUB_ENV
47-
- name: Build solution
48-
run: echo "Current version is \"$GitVersion_SemVer\"" && dotnet build -c Release
49-
- name: Create NuGet packages
50-
run: dotnet pack -c Release --no-build -o nupkg
51-
- name: Upload nuget packages
52-
uses: actions/upload-artifact@v1
53-
with:
54-
name: nupkg
55-
path: nupkg
56-
57-
test:
58-
name: Test
59-
needs: [build, generateVersionInfo]
6018
runs-on: ubuntu-latest
6119
steps:
62-
- name: Checkout
63-
uses: actions/checkout@v2
64-
- name: Download version info file
65-
uses: actions/download-artifact@v1
66-
with:
67-
name: gitversion
68-
path: ./
69-
- name: Inject version info into environment
70-
run: cat ./gitversion.env >> $GITHUB_ENV
71-
- name: Run tests
72-
run: echo "Current version is \"$GitVersion_SemVer\"" && dotnet test -c Release
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
with:
23+
fetch-depth: 0
24+
- name: Install dependencies
25+
run: dotnet restore
26+
- name: Build solution
27+
run: dotnet build -c Release --no-restore
28+
- name: Run tests
29+
run: dotnet test -c Release --no-build --verbosity normal
30+
- name: Create NuGet packages
31+
run: dotnet pack -c Release --no-build -o nupkg
32+
- name: Upload nuget packages
33+
uses: actions/upload-artifact@v1
34+
with:
35+
name: nupkg
36+
path: nupkg

.github/workflows/master.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Master workflow
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- "release/**"
7+
- "releases/**"
8+
tags:
9+
- v*
10+
- V*
11+
env:
12+
DOTNET_CLI_TELEMETRY_OPTOUT: true
13+
MSBUILDSINGLELOADCONTEXT: 1
14+
jobs:
15+
build:
16+
name: Build
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
with:
22+
fetch-depth: 0
23+
- name: Install dependencies
24+
run: dotnet restore
25+
- name: Build solution
26+
run: dotnet build -c Release --no-restore
27+
- name: Run tests
28+
run: dotnet test -c Release --no-build --verbosity normal
29+
- name: Create NuGet packages
30+
run: dotnet pack -c Release --no-build -o nupkg
31+
- name: Upload nuget packages
32+
uses: actions/upload-artifact@v1
33+
with:
34+
name: nupkg
35+
path: nupkg
36+
- name: Publish Nuget to GitHub registry
37+
run: dotnet nuget push ./nupkg/*.nupkg -s https://api.nuget.org/v3/index.json -k ${NUGET_API_KEY}
38+
env:
39+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

FluentAssertions.Reactive.sln

+13-1
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,20 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
2020
.gitattributes = .gitattributes
2121
.gitignore = .gitignore
2222
GitVersion.yml = GitVersion.yml
23-
global.json = global.json
2423
README.md = README.md
2524
EndProjectSection
2625
EndProject
26+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{9752AE39-8707-49B9-82B8-DB54174DE84F}"
27+
ProjectSection(SolutionItems) = preProject
28+
.github\PULL_REQUEST_TEMPLATE.md = .github\PULL_REQUEST_TEMPLATE.md
29+
EndProjectSection
30+
EndProject
31+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{9D902F3D-7CC4-4EA3-9C38-2751693C6D4A}"
32+
ProjectSection(SolutionItems) = preProject
33+
.github\workflows\branches.yml = .github\workflows\branches.yml
34+
.github\workflows\master.yml = .github\workflows\master.yml
35+
EndProjectSection
36+
EndProject
2737
Global
2838
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2939
Debug|Any CPU = Debug|Any CPU
@@ -65,6 +75,8 @@ Global
6575
GlobalSection(NestedProjects) = preSolution
6676
{FBBA1F0F-2782-4C58-9F66-2CFCBAF043C2} = {00D5194F-4335-4B15-B486-7DB272B65547}
6777
{F7FA72E3-365F-4F5C-8B5B-377DDE9B8B2F} = {FF4404AB-62EB-4964-AA9C-E62364EC6952}
78+
{9752AE39-8707-49B9-82B8-DB54174DE84F} = {0593589C-673C-47EB-8B56-E6B83DA2580E}
79+
{9D902F3D-7CC4-4EA3-9C38-2751693C6D4A} = {9752AE39-8707-49B9-82B8-DB54174DE84F}
6880
EndGlobalSection
6981
GlobalSection(ExtensibilityGlobals) = postSolution
7082
SolutionGuid = {FB99E965-4EAB-437C-A80D-DB5934C53CE6}

Src/FluentAssertions.Reactive/FluentAssertions.Reactive.csproj

+9-28
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,36 @@
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
66
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
7+
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
78
</PropertyGroup>
89

910
<PropertyGroup>
1011
<Authors>Alexander Rose</Authors>
1112
<PackageDescription>
1213
An extension to use FluidAssertions to test code using the System.Reactive library
1314
</PackageDescription>
14-
<RepositoryUrl>https://github.com/fluentassertions/fluentassertions.reactive</RepositoryUrl>
15+
<PackageProjectUrl>https://github.com/fluentassertions/fluentassertions.reactive</PackageProjectUrl>
16+
<PackageReleaseNotes>See https://github.com/fluentassertions/fluentassertions.reactive/releases</PackageReleaseNotes>
17+
<RepositoryUrl>https://github.com/fluentassertions/fluentassertions.reactive.git</RepositoryUrl>
1518
<RepositoryType>git</RepositoryType>
1619
<PackageTags>MSTest2;xUnit;NUnit;MSpec;NSpec;TDD;BDD;Fluent;netcore;netstandard;uwp;Reactive</PackageTags>
1720
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
1821
<PackageIcon>FluentAssertions.png</PackageIcon>
19-
<LangVersion>8.0</LangVersion>
22+
<LangVersion>latest</LangVersion>
2023
</PropertyGroup>
2124

2225
<ItemGroup>
23-
<PackageReference Include="FluentAssertions" Version="5.10.3" />
24-
<PackageReference Include="Microsoft.Reactive.Testing" Version="4.4.1" />
25-
</ItemGroup>
26-
27-
<ItemGroup>
28-
<PackageReference Include="GitVersionTask" Version="5.6.7">
26+
<PackageReference Include="FluentAssertions" Version="6.2.0" />
27+
<PackageReference Include="GitVersion.MsBuild" Version="5.7.0">
2928
<PrivateAssets>all</PrivateAssets>
3029
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3130
</PackageReference>
31+
<PackageReference Include="Microsoft.Reactive.Testing" Version="5.0.0" />
3232
</ItemGroup>
3333

3434
<ItemGroup>
35-
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" PrivateAssets="all" />
35+
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="all" />
3636
<None Include="..\FluentAssertions.png" Pack="true" Visible="false" PackagePath="" />
3737
</ItemGroup>
3838

39-
<PropertyGroup Condition=" '$(GitVersion_SemVer)' != ''">
40-
<GetVersion>false</GetVersion>
41-
<WriteVersionInfoToBuildLog>false</WriteVersionInfoToBuildLog>
42-
<UpdateAssemblyInfo>false</UpdateAssemblyInfo>
43-
<GenerateGitVersionInformation>false</GenerateGitVersionInformation>
44-
45-
<Version>$(GitVersion_FullSemVer)</Version>
46-
<VersionPrefix>$(GitVersion_MajorMinorPatch)</VersionPrefix>
47-
<VersionSuffix Condition=" '$(UseFullSemVerForNuGet)' == 'false' ">$(GitVersion_NuGetPreReleaseTag)</VersionSuffix>
48-
<VersionSuffix Condition=" '$(UseFullSemVerForNuGet)' == 'true' ">$(GitVersion_PreReleaseTag)</VersionSuffix>
49-
<PackageVersion Condition=" '$(UseFullSemVerForNuGet)' == 'false' ">$(GitVersion_NuGetVersion)</PackageVersion>
50-
<PackageVersion Condition=" '$(UseFullSemVerForNuGet)' == 'true' ">$(GitVersion_FullSemVer)</PackageVersion>
51-
<InformationalVersion Condition=" '$(InformationalVersion)' == '' ">$(GitVersion_InformationalVersion)</InformationalVersion>
52-
<AssemblyVersion Condition=" '$(AssemblyVersion)' == '' ">$(GitVersion_AssemblySemVer)</AssemblyVersion>
53-
<FileVersion Condition=" '$(FileVersion)' == '' ">$(GitVersion_AssemblySemFileVer)</FileVersion>
54-
<RepositoryBranch Condition=" '$(RepositoryBranch)' == '' ">$(GitVersion_BranchName)</RepositoryBranch>
55-
<RepositoryCommit Condition=" '$(RepositoryCommit)' == '' ">$(GitVersion_Sha)</RepositoryCommit>
56-
</PropertyGroup>
57-
5839
</Project>

Src/FluentAssertions.Reactive/ReactiveAssertions.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public async Task<AndWhichConstraint<ReactiveAssertions<TPayload>, IEnumerable<T
8989
.Timeout(timeout)
9090
.Catch<TPayload, TimeoutException>(exception => Observable.Empty<TPayload>())
9191
.ToList()
92-
.ToTask();
92+
.ToTask().ConfigureAwait(false);
9393
}
9494
catch (Exception e)
9595
{
@@ -174,7 +174,7 @@ public async Task<ExceptionAssertions<TException>> ThrowAsync<TException>(TimeSp
174174
string because = "", params object[] becauseArgs)
175175
where TException : Exception
176176
{
177-
var notifications = await GetRecordedNotifications(timeout);
177+
var notifications = await GetRecordedNotifications(timeout).ConfigureAwait(false);
178178
return Throw<TException>(notifications, because, becauseArgs);
179179
}
180180

@@ -206,7 +206,7 @@ public AndConstraint<ReactiveAssertions<TPayload>> Complete(TimeSpan timeout,
206206
public async Task<AndConstraint<ReactiveAssertions<TPayload>>> CompleteAsync(TimeSpan timeout,
207207
string because = "", params object[] becauseArgs)
208208
{
209-
var notifications = await GetRecordedNotifications(timeout);
209+
var notifications = await GetRecordedNotifications(timeout).ConfigureAwait(false);
210210

211211
return Complete(timeout, because, becauseArgs, notifications);
212212
}

Src/FluentAssertions.Reactive/ReactiveExtensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static async Task<TPayload> GetLastMessageAsync<TPayload>(
7878
this Task<AndWhichConstraint<ReactiveAssertions<TPayload>, IEnumerable<TPayload>>>
7979
assertionTask)
8080
{
81-
var constraint = await assertionTask;
81+
var constraint = await assertionTask.ConfigureAwait(false);
8282
return constraint.Subject.LastOrDefault();
8383
}
8484

Tests/FluentAssertions.Reactive.Specs/FluentAssertions.Reactive.Specs.csproj

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
11-
<PackageReference Include="xunit" Version="2.4.0" />
12-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
13-
<PackageReference Include="coverlet.collector" Version="1.2.0" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
11+
<PackageReference Include="xunit" Version="2.4.1" />
12+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
13+
<PrivateAssets>all</PrivateAssets>
14+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
15+
</PackageReference>
16+
<PackageReference Include="coverlet.collector" Version="3.1.0">
17+
<PrivateAssets>all</PrivateAssets>
18+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
19+
</PackageReference>
1420
</ItemGroup>
1521

1622
<ItemGroup>

global.json

-6
This file was deleted.

0 commit comments

Comments
 (0)