diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index bc633366..3fd9082e 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -18,11 +18,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup .NET SDK
- uses: actions/setup-dotnet@v1
+ uses: actions/setup-dotnet@v4
with:
dotnet-version: |
- 6.0.x
- 7.0.x
+ 8.0.x
source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -33,7 +32,7 @@ jobs:
- name: Pack solution [Release]
run: dotnet pack --no-restore --no-build -c Release -p:VersionSuffix=$GITHUB_RUN_NUMBER -o out
- name: Upload artifacts
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: Nuget packages
path: |
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index f275bab8..27bebdf8 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -25,7 +25,7 @@ jobs:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Initialize CodeQL
- uses: github/codeql-action/init@v2
+ uses: github/codeql-action/init@v3
with:
queries: security-and-quality
languages: csharp
@@ -37,4 +37,4 @@ jobs:
run: dotnet build --no-restore
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v2
+ uses: github/codeql-action/analyze@v3
diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml
index 4b4818d5..3c6e1a58 100644
--- a/.github/workflows/format.yml
+++ b/.github/workflows/format.yml
@@ -25,9 +25,9 @@ jobs:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup .NET SDK
- uses: actions/setup-dotnet@v1
+ uses: actions/setup-dotnet@v4
with:
- dotnet-version: 7.0.x
+ dotnet-version: 8.0.x
source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 55756faf..7d7fb240 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -28,11 +28,10 @@ jobs:
echo version=$version
echo "version=$version" >> $GITHUB_ENV
- name: Setup .NET SDK
- uses: actions/setup-dotnet@v1
+ uses: actions/setup-dotnet@v4
with:
dotnet-version: |
- 6.0.x
- 7.0.x
+ 8.0.x
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.NUGET_AUTH_TOKEN}}
@@ -43,7 +42,7 @@ jobs:
- name: Pack solution [Release]
run: dotnet pack --no-restore --no-build -c Release -p:Version=$version -o out
- name: Upload Nuget packages as workflow artifacts
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: Nuget packages
path: |
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index f95bae54..b983eace 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -41,7 +41,7 @@ jobs:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup .NET SDK
- uses: actions/setup-dotnet@v1
+ uses: actions/setup-dotnet@v4
with:
dotnet-version: |
2.1.x
@@ -49,6 +49,7 @@ jobs:
5.0.x
6.0.x
7.0.x
+ 8.0.x
source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
diff --git a/Directory.Build.targets b/Directory.Build.targets
index 233f9c6d..b651a1a4 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -10,6 +10,10 @@
$(MSBuildThisFileDirectory)graphql.snk
+
+ 2.1.30
+
+
diff --git a/Tests.props b/Tests.props
index 66e5c827..0b4bb968 100644
--- a/Tests.props
+++ b/Tests.props
@@ -3,7 +3,7 @@
false
- $(NoWarn);CS1591;CS1998;IDE0017;IDE0053;CA1707;CA1816;CA1822;CA1825;CA1835;CA1852;CA2201
+ $(NoWarn);CS1591;CS1998;IDE0017;IDE0053;CA1707;CA1816;CA1822;CA1825;CA1835;CA1852;CA2201;CA1861
false
@@ -13,22 +13,25 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
-
+
-
-
+
+
+
+
+
diff --git a/samples/Samples.Authorization/Samples.Authorization.csproj b/samples/Samples.Authorization/Samples.Authorization.csproj
index 2397ebff..5a09d21d 100644
--- a/samples/Samples.Authorization/Samples.Authorization.csproj
+++ b/samples/Samples.Authorization/Samples.Authorization.csproj
@@ -1,17 +1,17 @@
- net7.0
+ net8.0
enable
enable
-
-
-
-
-
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/samples/Samples.Basic/Samples.Basic.csproj b/samples/Samples.Basic/Samples.Basic.csproj
index b87fcf9c..0475f3df 100644
--- a/samples/Samples.Basic/Samples.Basic.csproj
+++ b/samples/Samples.Basic/Samples.Basic.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net8.0
enable
enable
diff --git a/samples/Samples.Complex/Samples.Complex.csproj b/samples/Samples.Complex/Samples.Complex.csproj
index e29d0ffb..2e996ff9 100644
--- a/samples/Samples.Complex/Samples.Complex.csproj
+++ b/samples/Samples.Complex/Samples.Complex.csproj
@@ -1,7 +1,7 @@
- net7;net6;net5;netcoreapp3.1
+ net8;net6;netcoreapp3.1
GraphQL.Samples.Server
GraphQL.Samples.Server
false
diff --git a/samples/Samples.Controller/Samples.Controller.csproj b/samples/Samples.Controller/Samples.Controller.csproj
index a947aa1d..d988df8d 100644
--- a/samples/Samples.Controller/Samples.Controller.csproj
+++ b/samples/Samples.Controller/Samples.Controller.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net8.0
enable
enable
diff --git a/samples/Samples.Cors/Samples.Cors.csproj b/samples/Samples.Cors/Samples.Cors.csproj
index b87fcf9c..0475f3df 100644
--- a/samples/Samples.Cors/Samples.Cors.csproj
+++ b/samples/Samples.Cors/Samples.Cors.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net8.0
enable
enable
diff --git a/samples/Samples.EndpointRouting/Samples.EndpointRouting.csproj b/samples/Samples.EndpointRouting/Samples.EndpointRouting.csproj
index b87fcf9c..0475f3df 100644
--- a/samples/Samples.EndpointRouting/Samples.EndpointRouting.csproj
+++ b/samples/Samples.EndpointRouting/Samples.EndpointRouting.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net8.0
enable
enable
diff --git a/samples/Samples.Jwt/Samples.Jwt.csproj b/samples/Samples.Jwt/Samples.Jwt.csproj
index 408b4c46..c90317c7 100644
--- a/samples/Samples.Jwt/Samples.Jwt.csproj
+++ b/samples/Samples.Jwt/Samples.Jwt.csproj
@@ -2,13 +2,13 @@
Exe
- net7.0
+ net8.0
enable
enable
-
+
diff --git a/samples/Samples.MultipleSchemas/Samples.MultipleSchemas.csproj b/samples/Samples.MultipleSchemas/Samples.MultipleSchemas.csproj
index 332a5986..ae1560d7 100644
--- a/samples/Samples.MultipleSchemas/Samples.MultipleSchemas.csproj
+++ b/samples/Samples.MultipleSchemas/Samples.MultipleSchemas.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net8.0
CS8618
diff --git a/samples/Samples.Pages/Samples.Pages.csproj b/samples/Samples.Pages/Samples.Pages.csproj
index 48a7d075..02e5f7ea 100644
--- a/samples/Samples.Pages/Samples.Pages.csproj
+++ b/samples/Samples.Pages/Samples.Pages.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net8.0
enable
enable
diff --git a/src/Authorization.AspNetCore/Authorization.AspNetCore.csproj b/src/Authorization.AspNetCore/Authorization.AspNetCore.csproj
index e14af124..da7a7f65 100644
--- a/src/Authorization.AspNetCore/Authorization.AspNetCore.csproj
+++ b/src/Authorization.AspNetCore/Authorization.AspNetCore.csproj
@@ -4,7 +4,6 @@
netstandard2.0;netcoreapp2.1;netcoreapp3.1;net5.0
Integration of GraphQL.NET validation subsystem into ASP.NET Core
GraphQL;authentication;authorization;validation
- enable
diff --git a/src/Authorization.AspNetCore/AuthorizationVisitor.cs b/src/Authorization.AspNetCore/AuthorizationVisitor.cs
index 0d989069..5754e4d9 100644
--- a/src/Authorization.AspNetCore/AuthorizationVisitor.cs
+++ b/src/Authorization.AspNetCore/AuthorizationVisitor.cs
@@ -8,7 +8,7 @@ namespace GraphQL.Server.Authorization.AspNetCore;
public partial class AuthorizationValidationRule
{
///
- [Obsolete("This class has been replaced by GraphQL.Server.Transports.AspNetCore.AuthorizationValidationRule.AuthorizationVisitor and will be removed in v8.")]
+ [Obsolete("This class has been replaced by GraphQL.Server.Transports.AspNetCore.AuthorizationVisitor and will be removed in v8.")]
public class AuthorizationVisitor : Transports.AspNetCore.AuthorizationVisitor
{
private readonly IAuthorizationErrorMessageBuilder _messageBuilder;
diff --git a/tests/ApiApprovalTests/ApiApprovalTests.csproj b/tests/ApiApprovalTests/ApiApprovalTests.csproj
index f151250b..70589ab0 100644
--- a/tests/ApiApprovalTests/ApiApprovalTests.csproj
+++ b/tests/ApiApprovalTests/ApiApprovalTests.csproj
@@ -2,11 +2,11 @@
- net7.0
+ net8.0
-
+
diff --git a/tests/ApiApprovalTests/net50+netcoreapp31/GraphQL.Server.Authorization.AspNetCore.approved.txt b/tests/ApiApprovalTests/net50+netcoreapp31/GraphQL.Server.Authorization.AspNetCore.approved.txt
index fe291010..819cd122 100644
--- a/tests/ApiApprovalTests/net50+netcoreapp31/GraphQL.Server.Authorization.AspNetCore.approved.txt
+++ b/tests/ApiApprovalTests/net50+netcoreapp31/GraphQL.Server.Authorization.AspNetCore.approved.txt
@@ -16,7 +16,7 @@ namespace GraphQL.Server.Authorization.AspNetCore
protected virtual void AddValidationError(GraphQLParser.AST.ASTNode? node, GraphQL.Validation.ValidationContext context, GraphQLParser.AST.OperationType? operationType, Microsoft.AspNetCore.Authorization.AuthorizationResult result) { }
public System.Threading.Tasks.ValueTask ValidateAsync(GraphQL.Validation.ValidationContext context) { }
[System.Obsolete("This class has been replaced by GraphQL.Server.Transports.AspNetCore.Authorizatio" +
- "nValidationRule.AuthorizationVisitor and will be removed in v8.")]
+ "nVisitor and will be removed in v8.")]
public class AuthorizationVisitor : GraphQL.Server.Transports.AspNetCore.AuthorizationVisitor
{
public AuthorizationVisitor(GraphQL.Validation.ValidationContext context, System.Security.Claims.ClaimsPrincipal claimsPrincipal, Microsoft.AspNetCore.Authorization.IAuthorizationService authorizationService, GraphQL.Server.Authorization.AspNetCore.IAuthorizationErrorMessageBuilder authorizationErrorMessageBuilder, GraphQL.Server.Authorization.AspNetCore.AuthorizationValidationRule authorizationValidationRule) { }
diff --git a/tests/ApiApprovalTests/netcoreapp21+netstandard20/GraphQL.Server.Authorization.AspNetCore.approved.txt b/tests/ApiApprovalTests/netcoreapp21+netstandard20/GraphQL.Server.Authorization.AspNetCore.approved.txt
index c1f01ac8..e2355721 100644
--- a/tests/ApiApprovalTests/netcoreapp21+netstandard20/GraphQL.Server.Authorization.AspNetCore.approved.txt
+++ b/tests/ApiApprovalTests/netcoreapp21+netstandard20/GraphQL.Server.Authorization.AspNetCore.approved.txt
@@ -16,7 +16,7 @@ namespace GraphQL.Server.Authorization.AspNetCore
protected virtual void AddValidationError(GraphQLParser.AST.ASTNode? node, GraphQL.Validation.ValidationContext context, GraphQLParser.AST.OperationType? operationType, Microsoft.AspNetCore.Authorization.AuthorizationResult result) { }
public System.Threading.Tasks.ValueTask ValidateAsync(GraphQL.Validation.ValidationContext context) { }
[System.Obsolete("This class has been replaced by GraphQL.Server.Transports.AspNetCore.Authorizatio" +
- "nValidationRule.AuthorizationVisitor and will be removed in v8.")]
+ "nVisitor and will be removed in v8.")]
public class AuthorizationVisitor : GraphQL.Server.Transports.AspNetCore.AuthorizationVisitor
{
public AuthorizationVisitor(GraphQL.Validation.ValidationContext context, System.Security.Claims.ClaimsPrincipal claimsPrincipal, Microsoft.AspNetCore.Authorization.IAuthorizationService authorizationService, GraphQL.Server.Authorization.AspNetCore.IAuthorizationErrorMessageBuilder authorizationErrorMessageBuilder, GraphQL.Server.Authorization.AspNetCore.AuthorizationValidationRule authorizationValidationRule) { }
diff --git a/tests/Authorization.AspNetCore.Tests/Authorization.AspNetCore.Tests.csproj b/tests/Authorization.AspNetCore.Tests/Authorization.AspNetCore.Tests.csproj
index 7333bd13..70a9eb18 100644
--- a/tests/Authorization.AspNetCore.Tests/Authorization.AspNetCore.Tests.csproj
+++ b/tests/Authorization.AspNetCore.Tests/Authorization.AspNetCore.Tests.csproj
@@ -2,7 +2,7 @@
- net7.0;net6.0;net5.0;netcoreapp3.1
+ net8.0;net7.0;net6.0;net5.0;netcoreapp3.1
disable
$(NoWarn);CS0618
@@ -10,6 +10,7 @@
+
diff --git a/tests/Authorization.AspNetCore.Tests/AuthorizationValidationRuleTests.cs b/tests/Authorization.AspNetCore.Tests/AuthorizationValidationRuleTests.cs
index 231a8941..bc84d099 100644
--- a/tests/Authorization.AspNetCore.Tests/AuthorizationValidationRuleTests.cs
+++ b/tests/Authorization.AspNetCore.Tests/AuthorizationValidationRuleTests.cs
@@ -313,7 +313,7 @@ Required claim 'admin' is not present.
});
}
- private static ISchema BasicSchema()
+ private static Schema BasicSchema()
{
string defs = """
type Query {
@@ -347,7 +347,7 @@ public class BasicQueryWithAttributesAndPropertyPolicy
public string Post { get; set; } = "";
}
- private ISchema NestedSchema()
+ private Schema NestedSchema()
{
string defs = """
type Query {
@@ -398,7 +398,7 @@ public class Author
public string Name { get; set; }
}
- private ISchema TypedSchema()
+ private Schema TypedSchema()
{
var query = new ObjectGraphType();
diff --git a/tests/Authorization.AspNetCore.Tests/ValidationTestBase.cs b/tests/Authorization.AspNetCore.Tests/ValidationTestBase.cs
index 34fb2799..2e717a83 100644
--- a/tests/Authorization.AspNetCore.Tests/ValidationTestBase.cs
+++ b/tests/Authorization.AspNetCore.Tests/ValidationTestBase.cs
@@ -29,14 +29,14 @@ protected void ShouldPassRule(Action configure)
config.Rules.Add(Rule);
configure(config);
- config.Rules.Any().ShouldBeTrue("Must provide at least one rule to validate against.");
+ config.Rules.ShouldNotBeEmpty("Must provide at least one rule to validate against.");
config.Schema.Initialize();
var result = Validate(config);
string message = "";
- if (result.Errors?.Any() == true)
+ if (result.Errors?.Count > 0)
{
message = string.Join(", ", result.Errors.Select(x => x.Message));
}
@@ -51,7 +51,7 @@ protected void ShouldFailRule(Action configure)
config.User = CreatePrincipal();
configure(config);
- config.Rules.Any().ShouldBeTrue("Must provide at least one rule to validate against.");
+ config.Rules.ShouldNotBeEmpty("Must provide at least one rule to validate against.");
config.Schema.Initialize();
diff --git a/tests/Samples.Authorization.Tests/Samples.Authorization.Tests.csproj b/tests/Samples.Authorization.Tests/Samples.Authorization.Tests.csproj
index d335d627..9e990633 100644
--- a/tests/Samples.Authorization.Tests/Samples.Authorization.Tests.csproj
+++ b/tests/Samples.Authorization.Tests/Samples.Authorization.Tests.csproj
@@ -2,7 +2,7 @@
- net7.0
+ net8.0
End to end tests for the Samples.Authorization project
diff --git a/tests/Samples.AzureFunctions.Tests/EndToEndTests.cs b/tests/Samples.AzureFunctions.Tests/EndToEndTests.cs
index 7dbae3b3..714baa5b 100644
--- a/tests/Samples.AzureFunctions.Tests/EndToEndTests.cs
+++ b/tests/Samples.AzureFunctions.Tests/EndToEndTests.cs
@@ -17,7 +17,7 @@ public async Task GraphQLGet()
{
request.Method = "GET";
request.QueryString = new QueryString("?query={count}");
- }, GraphQL.RunGraphQL).ConfigureAwait(false);
+ }, GraphQL.RunGraphQL);
statusCode.ShouldBe(200);
contentType.ShouldBe("application/graphql-response+json; charset=utf-8");
@@ -32,7 +32,7 @@ public async Task GraphQLPost()
request.Method = "POST";
request.ContentType = "application/json";
request.Body = new MemoryStream(Encoding.UTF8.GetBytes("""{"query":"{count}"}"""));
- }, GraphQL.RunGraphQL).ConfigureAwait(false);
+ }, GraphQL.RunGraphQL);
statusCode.ShouldBe(200);
contentType.ShouldBe("application/graphql-response+json; charset=utf-8");
@@ -45,7 +45,7 @@ public async Task Playground()
var (statusCode, contentType, body) = await ExecuteRequest(request =>
{
request.Method = "GET";
- }, GraphQL.RunPlayground).ConfigureAwait(false);
+ }, GraphQL.RunPlayground);
statusCode.ShouldBe(200);
contentType.ShouldBe("text/html");
diff --git a/tests/Samples.Basic.Tests/Samples.Basic.Tests.csproj b/tests/Samples.Basic.Tests/Samples.Basic.Tests.csproj
index 91868a52..cc3bc3fb 100644
--- a/tests/Samples.Basic.Tests/Samples.Basic.Tests.csproj
+++ b/tests/Samples.Basic.Tests/Samples.Basic.Tests.csproj
@@ -2,7 +2,7 @@
- net7.0
+ net8.0
End to end tests for the Samples.Basic project
diff --git a/tests/Samples.Complex.Tests/Samples.Complex.Tests.csproj b/tests/Samples.Complex.Tests/Samples.Complex.Tests.csproj
index c314615e..904fdfb2 100644
--- a/tests/Samples.Complex.Tests/Samples.Complex.Tests.csproj
+++ b/tests/Samples.Complex.Tests/Samples.Complex.Tests.csproj
@@ -2,7 +2,7 @@
- net7.0;net6.0;net5.0;netcoreapp3.1
+ net8.0;net6.0;netcoreapp3.1
End to end tests for Samples.Server project
diff --git a/tests/Samples.Complex.Tests/Serializer.cs b/tests/Samples.Complex.Tests/Serializer.cs
index da90f2f6..43282700 100644
--- a/tests/Samples.Complex.Tests/Serializer.cs
+++ b/tests/Samples.Complex.Tests/Serializer.cs
@@ -15,11 +15,9 @@ internal static string ToJson(GraphQLRequest request)
internal static string ToJson(GraphQLRequest[] requests)
=> ToJson(Array.ConvertAll(requests, r => r.ToDictionary()));
+ private static readonly JsonSerializerOptions _jsonSerializerOptions = new() { DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull };
public static string ToJson(object obj)
- => JsonSerializer.Serialize(obj, new JsonSerializerOptions
- {
- DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull
- });
+ => JsonSerializer.Serialize(obj, _jsonSerializerOptions);
internal static FormUrlEncodedContent ToFormUrlEncodedContent(GraphQLRequest request)
{
diff --git a/tests/Samples.Controller.Tests/Samples.Controller.Tests.csproj b/tests/Samples.Controller.Tests/Samples.Controller.Tests.csproj
index d989a609..094e1bf6 100644
--- a/tests/Samples.Controller.Tests/Samples.Controller.Tests.csproj
+++ b/tests/Samples.Controller.Tests/Samples.Controller.Tests.csproj
@@ -2,7 +2,7 @@
- net7.0
+ net8.0
End to end tests for the Samples.Controller project
diff --git a/tests/Samples.Cors.Tests/Samples.Cors.Tests.csproj b/tests/Samples.Cors.Tests/Samples.Cors.Tests.csproj
index 2aa5f82f..d4185c5f 100644
--- a/tests/Samples.Cors.Tests/Samples.Cors.Tests.csproj
+++ b/tests/Samples.Cors.Tests/Samples.Cors.Tests.csproj
@@ -2,7 +2,7 @@
- net7.0
+ net8.0
End to end tests for the Samples.Cors project
diff --git a/tests/Samples.EndpointRouting.Tests/Samples.EndpointRouting.Tests.csproj b/tests/Samples.EndpointRouting.Tests/Samples.EndpointRouting.Tests.csproj
index 36e092e3..13c46f62 100644
--- a/tests/Samples.EndpointRouting.Tests/Samples.EndpointRouting.Tests.csproj
+++ b/tests/Samples.EndpointRouting.Tests/Samples.EndpointRouting.Tests.csproj
@@ -2,7 +2,7 @@
- net7.0
+ net8.0
End to end tests for the Samples.EndpointRouting project
diff --git a/tests/Samples.Jwt.Tests/Samples.Jwt.Tests.csproj b/tests/Samples.Jwt.Tests/Samples.Jwt.Tests.csproj
index f3ac84c2..358492d7 100644
--- a/tests/Samples.Jwt.Tests/Samples.Jwt.Tests.csproj
+++ b/tests/Samples.Jwt.Tests/Samples.Jwt.Tests.csproj
@@ -2,7 +2,7 @@
- net7.0
+ net8.0
End to end tests for the Samples.Jwt project
diff --git a/tests/Samples.MultipleSchemas.Tests/Samples.MultipleSchemas.Tests.csproj b/tests/Samples.MultipleSchemas.Tests/Samples.MultipleSchemas.Tests.csproj
index 10c99fd1..8e0402c0 100644
--- a/tests/Samples.MultipleSchemas.Tests/Samples.MultipleSchemas.Tests.csproj
+++ b/tests/Samples.MultipleSchemas.Tests/Samples.MultipleSchemas.Tests.csproj
@@ -2,7 +2,7 @@
- net7.0
+ net8.0
End to end tests for the Samples.MultipleSchemas project
diff --git a/tests/Samples.Pages.Tests/Samples.Pages.Tests.csproj b/tests/Samples.Pages.Tests/Samples.Pages.Tests.csproj
index 3ba8a5c2..be65283b 100644
--- a/tests/Samples.Pages.Tests/Samples.Pages.Tests.csproj
+++ b/tests/Samples.Pages.Tests/Samples.Pages.Tests.csproj
@@ -2,7 +2,7 @@
- net7.0
+ net8.0
End to end tests for the Samples.Pages project
diff --git a/tests/Samples.Tests/Samples.Tests.csproj b/tests/Samples.Tests/Samples.Tests.csproj
index 061fadd0..0917021e 100644
--- a/tests/Samples.Tests/Samples.Tests.csproj
+++ b/tests/Samples.Tests/Samples.Tests.csproj
@@ -2,11 +2,11 @@
- net7.0;netcoreapp2.1
+ net8.0;net6.0;netcoreapp2.1
true
- net7.0;netcoreapp2.1;net48
+ net8.0;net6.0;netcoreapp2.1;net48
true
@@ -17,4 +17,8 @@
+
+
+
+
diff --git a/tests/Samples.Tests/WebSocketExtensions.cs b/tests/Samples.Tests/WebSocketExtensions.cs
index bbdfd03c..6547b4f6 100644
--- a/tests/Samples.Tests/WebSocketExtensions.cs
+++ b/tests/Samples.Tests/WebSocketExtensions.cs
@@ -1,7 +1,6 @@
using System.Net.WebSockets;
using System.Text;
using System.Text.Json;
-using GraphQL;
using GraphQL.SystemTextJson;
using GraphQL.Transport;
#if NET48
@@ -15,7 +14,7 @@ namespace Samples.Tests;
public static class WebSocketExtensions
{
- private static readonly IGraphQLTextSerializer _serializer = new GraphQLSerializer();
+ private static readonly GraphQLSerializer _serializer = new();
public static Task SendMessageAsync(this WebSocket socket, OperationMessage message)
=> SendStringAsync(socket, _serializer.Serialize(message));
diff --git a/tests/Transports.AspNetCore.Tests/AuthorizationTests.cs b/tests/Transports.AspNetCore.Tests/AuthorizationTests.cs
index fb506f1b..617f9fbc 100644
--- a/tests/Transports.AspNetCore.Tests/AuthorizationTests.cs
+++ b/tests/Transports.AspNetCore.Tests/AuthorizationTests.cs
@@ -591,7 +591,7 @@ public void MiscErrors(bool noClaimsPrincipal, bool noRequestServices, bool noAu
}
[Fact]
- public void NullIdentity()
+ public async Task NullIdentity()
{
var mockAuthorizationService = new Mock(MockBehavior.Strict);
var mockServices = new Mock(MockBehavior.Strict);
@@ -600,7 +600,7 @@ public void NullIdentity()
var validator = new DocumentValidator();
_schema.Authorize();
- var (result, _) = validator.ValidateAsync(new ValidationOptions
+ var (result, _) = await validator.ValidateAsync(new ValidationOptions
{
Document = document,
Extensions = Inputs.Empty,
@@ -611,7 +611,7 @@ public void NullIdentity()
Variables = Inputs.Empty,
RequestServices = mockServices.Object,
User = new ClaimsPrincipal(),
- }).GetAwaiter().GetResult(); // there is no async code being tested
+ });
result.Errors.ShouldHaveSingleItem().ShouldBeOfType().Message.ShouldBe("Access denied for schema.");
}
@@ -681,7 +681,7 @@ public void WithInterface(bool interfaceRequiresAuth, bool queryRequiresAuth, bo
[InlineData("{ parent { child(invalid: true) } }", null, true)]
[InlineData("query { ...frag1 }", null, true)]
[InlineData("query { ...frag1 } fragment frag1 on QueryType { ...frag1 }", null, true)]
- public void TestDefective(string query, string variables, bool expectedIsValid)
+ public void TestDefective(string query, string? variables, bool expectedIsValid)
{
_query.AddField(new FieldType { Name = "test", Type = typeof(StringGraphType) }).Authorize();
diff --git a/tests/Transports.AspNetCore.Tests/ChatTests.cs b/tests/Transports.AspNetCore.Tests/ChatTests.cs
index 356abba0..3bde5548 100644
--- a/tests/Transports.AspNetCore.Tests/ChatTests.cs
+++ b/tests/Transports.AspNetCore.Tests/ChatTests.cs
@@ -12,7 +12,7 @@ public ChatTests()
_app = new(ConfigureBuilder());
}
- private IWebHostBuilder ConfigureBuilder()
+ private WebHostBuilder ConfigureBuilder()
{
var hostBuilder = new WebHostBuilder();
hostBuilder.ConfigureServices(services =>
diff --git a/tests/Transports.AspNetCore.Tests/Middleware/AuthorizationTests.cs b/tests/Transports.AspNetCore.Tests/Middleware/AuthorizationTests.cs
index e54cb5f0..a042a02f 100644
--- a/tests/Transports.AspNetCore.Tests/Middleware/AuthorizationTests.cs
+++ b/tests/Transports.AspNetCore.Tests/Middleware/AuthorizationTests.cs
@@ -29,6 +29,7 @@ private TestServer CreateServer(Action? configureServices =
.AddAutoSchema()
.AddErrorInfoProvider(new CustomErrorInfoProvider(this))
.AddSystemTextJson());
+ services.AddRouting();
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
diff --git a/tests/Transports.AspNetCore.Tests/Transports.AspNetCore.Tests.csproj b/tests/Transports.AspNetCore.Tests/Transports.AspNetCore.Tests.csproj
index 82b5927a..53f661bb 100644
--- a/tests/Transports.AspNetCore.Tests/Transports.AspNetCore.Tests.csproj
+++ b/tests/Transports.AspNetCore.Tests/Transports.AspNetCore.Tests.csproj
@@ -2,15 +2,15 @@
- netcoreapp2.1;netcoreapp3.1;net5.0;net6.0;net7.0
+ netcoreapp2.1;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0
true
- net48;netcoreapp2.1;netcoreapp3.1;net5.0;net6.0;net7.0
+ net48;netcoreapp2.1;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0
true
- net7.0
+ net8.0
@@ -43,6 +43,7 @@
+
diff --git a/tests/Transports.AspNetCore.Tests/WebSocketExtensions.cs b/tests/Transports.AspNetCore.Tests/WebSocketExtensions.cs
index 358b9978..db9c3362 100644
--- a/tests/Transports.AspNetCore.Tests/WebSocketExtensions.cs
+++ b/tests/Transports.AspNetCore.Tests/WebSocketExtensions.cs
@@ -11,7 +11,7 @@ namespace Tests;
public static class WebSocketExtensions
{
- private static readonly IGraphQLTextSerializer _serializer = new GraphQLSerializer();
+ private static readonly GraphQLSerializer _serializer = new GraphQLSerializer();
public static Task SendMessageAsync(this WebSocket socket, OperationMessage message)
=> SendStringAsync(socket, _serializer.Serialize(message));
diff --git a/tests/Transports.AspNetCore.Tests/WebSockets/NewSubscriptionServerTests.cs b/tests/Transports.AspNetCore.Tests/WebSockets/NewSubscriptionServerTests.cs
index 4d0a0efc..29bdd333 100644
--- a/tests/Transports.AspNetCore.Tests/WebSockets/NewSubscriptionServerTests.cs
+++ b/tests/Transports.AspNetCore.Tests/WebSockets/NewSubscriptionServerTests.cs
@@ -232,7 +232,7 @@ public async Task OnPongAsync()
[InlineData("abc")]
[InlineData("")]
[InlineData(null)]
- public async Task OnSubscribe(string id)
+ public async Task OnSubscribe(string? id)
{
var message = new OperationMessage() { Id = id };
_mockServer.Protected().Setup("OnSubscribeAsync", message).CallBase().Verifiable();
@@ -248,7 +248,7 @@ public async Task OnSubscribe(string id)
[InlineData("abc")]
[InlineData("")]
[InlineData(null)]
- public async Task OnComplete(string id)
+ public async Task OnComplete(string? id)
{
var message = new OperationMessage() { Id = id };
_mockServer.Protected().Setup("OnCompleteAsync", message).CallBase().Verifiable();
diff --git a/tests/Transports.AspNetCore.Tests/WebSockets/OldSubscriptionServerTests.cs b/tests/Transports.AspNetCore.Tests/WebSockets/OldSubscriptionServerTests.cs
index 2a322d26..55828243 100644
--- a/tests/Transports.AspNetCore.Tests/WebSockets/OldSubscriptionServerTests.cs
+++ b/tests/Transports.AspNetCore.Tests/WebSockets/OldSubscriptionServerTests.cs
@@ -190,7 +190,7 @@ public async Task OnConnectionAcknowledgeAsync()
[InlineData("abc")]
[InlineData("")]
[InlineData(null)]
- public async Task OnStart(string id)
+ public async Task OnStart(string? id)
{
var message = new OperationMessage() { Id = id };
_mockServer.Protected().Setup("OnStartAsync", message).CallBase().Verifiable();
@@ -206,7 +206,7 @@ public async Task OnStart(string id)
[InlineData("abc")]
[InlineData("")]
[InlineData(null)]
- public async Task OnStop(string id)
+ public async Task OnStop(string? id)
{
var message = new OperationMessage() { Id = id };
_mockServer.Protected().Setup("OnStopAsync", message).CallBase().Verifiable();