Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix analyzer tests #28

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="JsonDocumentPath" Version="1.0.3" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" Version="1.1.1" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageVersion Include="OneOf" Version="3.0.263" />
<PackageVersion Include="Remora.Results" Version="7.4.1" />
<PackageVersion Include="Remora.Results.Analyzers" Version="1.0.2" />
<PackageVersion Include="RichardSzalay.MockHttp" Version="7.0.0" />
<PackageVersion Include="System.Text.Json" Version="8.0.0" />
<PackageVersion Include="xunit.assert" Version="2.6.2" />
<PackageVersion Include="System.Text.Json" Version="8.0.1" />
<PackageVersion Include="xunit.assert" Version="2.6.6" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0-1.final" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.1.1" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Remora.Rest/Http/RestHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ private async Task<Result<TEntity>> UnpackResponseAsync<TEntity>
}

// See if we have a JSON error to get some more details from
if (response.Content.Headers.ContentLength is not > 0)
if (response.Content.Headers.ContentLength == 0)
{
return new HttpResultError(response.StatusCode, response.ReasonPhrase);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
using Microsoft.CodeAnalysis.CSharp.Testing;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Testing;
using Microsoft.CodeAnalysis.Testing.Verifiers;

namespace Remora.Rest.Core.Analyzers.Tests.TestBases;

/// <summary>
/// Serves as a base class for Optional-targeted analyzer tests.
/// </summary>
/// <typeparam name="TAnalyzer">The analyzer under test.</typeparam>
public abstract class OptionalAnalyzerTests<TAnalyzer> : CSharpAnalyzerTest<TAnalyzer, XUnitVerifier>
public abstract class OptionalAnalyzerTests<TAnalyzer> : CSharpAnalyzerTest<TAnalyzer, DefaultVerifier>
where TAnalyzer : DiagnosticAnalyzer, new()
{
/// <summary>
Expand All @@ -26,9 +25,9 @@ protected OptionalAnalyzerTests()
{
this.ReferenceAssemblies = new ReferenceAssemblies
(
"net7.0",
new PackageIdentity("Microsoft.NETCore.App.Ref", "7.0.0"),
Path.Combine("ref", "net7.0")
"net8.0",
new PackageIdentity("Microsoft.NETCore.App.Ref", "8.0.1"),
Path.Combine("ref", "net8.0")
);

this.TestState.AdditionalReferences.Add(typeof(Optional<>).Assembly);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using Microsoft.CodeAnalysis.CSharp.Testing;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Testing;
using Microsoft.CodeAnalysis.Testing.Verifiers;

namespace Remora.Rest.Core.Analyzers.Tests.TestBases;

Expand All @@ -18,7 +17,7 @@ namespace Remora.Rest.Core.Analyzers.Tests.TestBases;
/// </summary>
/// <typeparam name="TAnalyzer">The analyzer under test.</typeparam>
/// <typeparam name="TCodeFix">The code fix under test.</typeparam>
public abstract class OptionalCodeFixTests<TAnalyzer, TCodeFix> : CSharpCodeFixTest<TAnalyzer, TCodeFix, XUnitVerifier>
public abstract class OptionalCodeFixTests<TAnalyzer, TCodeFix> : CSharpCodeFixTest<TAnalyzer, TCodeFix, DefaultVerifier>
where TAnalyzer : DiagnosticAnalyzer, new()
where TCodeFix : CodeFixProvider, new()
{
Expand All @@ -29,9 +28,9 @@ protected OptionalCodeFixTests()
{
this.ReferenceAssemblies = new ReferenceAssemblies
(
"net7.0",
new PackageIdentity("Microsoft.NETCore.App.Ref", "7.0.0"),
Path.Combine("ref", "net7.0")
"net8.0",
new PackageIdentity("Microsoft.NETCore.App.Ref", "8.0.1"),
Path.Combine("ref", "net8.0")
);

this.TestState.AdditionalReferences.Add(typeof(Optional<int>).Assembly);
Expand Down
Loading