diff --git a/src/GraphQL.Client.LocalExecution/GraphQL.Client.LocalExecution.csproj b/src/GraphQL.Client.LocalExecution/GraphQL.Client.LocalExecution.csproj index 04261eb7..1e5575e0 100644 --- a/src/GraphQL.Client.LocalExecution/GraphQL.Client.LocalExecution.csproj +++ b/src/GraphQL.Client.LocalExecution/GraphQL.Client.LocalExecution.csproj @@ -6,8 +6,8 @@ - - + + diff --git a/src/GraphQL.Client.Serializer.SystemTextJson/GraphQL.Client.Serializer.SystemTextJson.csproj b/src/GraphQL.Client.Serializer.SystemTextJson/GraphQL.Client.Serializer.SystemTextJson.csproj index e49b975d..bd570172 100644 --- a/src/GraphQL.Client.Serializer.SystemTextJson/GraphQL.Client.Serializer.SystemTextJson.csproj +++ b/src/GraphQL.Client.Serializer.SystemTextJson/GraphQL.Client.Serializer.SystemTextJson.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/GraphQL.Client.Serializer.SystemTextJson/ImmutableConverter.cs b/src/GraphQL.Client.Serializer.SystemTextJson/ImmutableConverter.cs index 2087631d..5a14d5ff 100644 --- a/src/GraphQL.Client.Serializer.SystemTextJson/ImmutableConverter.cs +++ b/src/GraphQL.Client.Serializer.SystemTextJson/ImmutableConverter.cs @@ -95,7 +95,10 @@ public override void Write(Utf8JsonWriter writer, object value, JsonSerializerOp DefaultBufferSize = options.DefaultBufferSize, DictionaryKeyPolicy = options.DictionaryKeyPolicy, Encoder = options.Encoder, +#pragma warning disable SYSLIB0020 + // obsolete warning disabled to keep compatibility until deprecated field is removed IgnoreNullValues = options.IgnoreNullValues, +#pragma warning restore SYSLIB0020 IgnoreReadOnlyProperties = options.IgnoreReadOnlyProperties, MaxDepth = options.MaxDepth, PropertyNameCaseInsensitive = options.PropertyNameCaseInsensitive, diff --git a/src/GraphQL.Client/GraphQL.Client.csproj b/src/GraphQL.Client/GraphQL.Client.csproj index 35dc2e16..241e3bcc 100644 --- a/src/GraphQL.Client/GraphQL.Client.csproj +++ b/src/GraphQL.Client/GraphQL.Client.csproj @@ -15,7 +15,7 @@ - + diff --git a/tests/GraphQL.Client.Serializer.Tests/BaseSerializerTest.cs b/tests/GraphQL.Client.Serializer.Tests/BaseSerializerTest.cs index 0a7102a1..7cf5c3e1 100644 --- a/tests/GraphQL.Client.Serializer.Tests/BaseSerializerTest.cs +++ b/tests/GraphQL.Client.Serializer.Tests/BaseSerializerTest.cs @@ -199,7 +199,8 @@ public async Task CanDeserializeObjectWithBothConstructorAndProperties() var contentStream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(jsonString)); // Act - var result = await ClientSerializer.DeserializeFromUtf8StreamAsync(contentStream, default).ConfigureAwait(false); + var result = await ClientSerializer + .DeserializeFromUtf8StreamAsync(contentStream, default); // Assert result.Data.Property1.Should().Be("value1"); diff --git a/tests/GraphQL.Client.Serializer.Tests/GraphQL.Client.Serializer.Tests.csproj b/tests/GraphQL.Client.Serializer.Tests/GraphQL.Client.Serializer.Tests.csproj index 7273de9a..edf3881f 100644 --- a/tests/GraphQL.Client.Serializer.Tests/GraphQL.Client.Serializer.Tests.csproj +++ b/tests/GraphQL.Client.Serializer.Tests/GraphQL.Client.Serializer.Tests.csproj @@ -7,8 +7,8 @@ - - + + @@ -19,4 +19,13 @@ + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/tests/GraphQL.Client.Tests.Common/GraphQL.Client.Tests.Common.csproj b/tests/GraphQL.Client.Tests.Common/GraphQL.Client.Tests.Common.csproj index 460fe724..f199b89a 100644 --- a/tests/GraphQL.Client.Tests.Common/GraphQL.Client.Tests.Common.csproj +++ b/tests/GraphQL.Client.Tests.Common/GraphQL.Client.Tests.Common.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/tests/GraphQL.Integration.Tests/GraphQL.Integration.Tests.csproj b/tests/GraphQL.Integration.Tests/GraphQL.Integration.Tests.csproj index fdc033fa..bb5b4616 100644 --- a/tests/GraphQL.Integration.Tests/GraphQL.Integration.Tests.csproj +++ b/tests/GraphQL.Integration.Tests/GraphQL.Integration.Tests.csproj @@ -7,8 +7,8 @@ - - + + @@ -18,4 +18,13 @@ + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/tests/GraphQL.Integration.Tests/QueryAndMutationTests/Base.cs b/tests/GraphQL.Integration.Tests/QueryAndMutationTests/Base.cs index 0b120ba4..cb25adc6 100644 --- a/tests/GraphQL.Integration.Tests/QueryAndMutationTests/Base.cs +++ b/tests/GraphQL.Integration.Tests/QueryAndMutationTests/Base.cs @@ -1,5 +1,4 @@ using System.Net; -using System.Net.Http.Headers; using FluentAssertions; using GraphQL.Client.Abstractions; using GraphQL.Client.Http; @@ -185,7 +184,7 @@ query Long { // unblock the query chatQuery.LongRunningQueryBlocker.Set(); // check execution time - request.Invoke().Result.Data.longRunning.Should().Be("finally returned"); + (await request.Invoke()).Data.longRunning.Should().Be("finally returned"); // reset stuff chatQuery.LongRunningQueryBlocker.Reset(); diff --git a/tests/GraphQL.Integration.Tests/UriExtensionTests.cs b/tests/GraphQL.Integration.Tests/UriExtensionTests.cs index 7e374578..80d032af 100644 --- a/tests/GraphQL.Integration.Tests/UriExtensionTests.cs +++ b/tests/GraphQL.Integration.Tests/UriExtensionTests.cs @@ -30,12 +30,12 @@ public void HasWebSocketSchemaTest(string url, bool result) [InlineData("ftp://this-url-cannot-be-converted.net", false, null)] // AppSync example [InlineData("wss://example1234567890000.appsync-realtime-api.us-west-2.amazonaws.com/graphql?header=123456789ABCDEF&payload=e30=", true, "wss://example1234567890000.appsync-realtime-api.us-west-2.amazonaws.com/graphql?header=123456789ABCDEF&payload=e30=")] - public void GetWebSocketUriTest(string input, bool canConvert, string result) + public void GetWebSocketUriTest(string input, bool canConvert, string? result) { var inputUri = new Uri(input); if (canConvert) { - inputUri.GetWebSocketUri().Should().BeEquivalentTo(new Uri(result)); + inputUri.GetWebSocketUri().Should().BeEquivalentTo(new Uri(result!)); } else { diff --git a/tests/GraphQL.Integration.Tests/UserAgentHeaderTests.cs b/tests/GraphQL.Integration.Tests/UserAgentHeaderTests.cs index bf631be5..ba5b7bbf 100644 --- a/tests/GraphQL.Integration.Tests/UserAgentHeaderTests.cs +++ b/tests/GraphQL.Integration.Tests/UserAgentHeaderTests.cs @@ -17,7 +17,7 @@ public UserAgentHeaderTests(SystemTextJsonAutoNegotiateServerTestFixture fixture Fixture = fixture; } - public async Task InitializeAsync() => await Fixture.CreateServer().ConfigureAwait(false); + public async Task InitializeAsync() => await Fixture.CreateServer(); public Task DisposeAsync() { @@ -32,7 +32,7 @@ public async void Can_set_custom_user_agent() ChatClient = Fixture.GetChatClient(options => options.DefaultUserAgentRequestHeader = ProductInfoHeaderValue.Parse(userAgent)); var graphQLRequest = new GraphQLRequest("query clientUserAgent { clientUserAgent }"); - var response = await ChatClient.SendQueryAsync(graphQLRequest, () => new { clientUserAgent = string.Empty }).ConfigureAwait(false); + var response = await ChatClient.SendQueryAsync(graphQLRequest, () => new { clientUserAgent = string.Empty }); response.Errors.Should().BeNull(); response.Data.clientUserAgent.Should().Be(userAgent); @@ -48,7 +48,7 @@ public async void Default_user_agent_is_set_as_expected() ChatClient = Fixture.GetChatClient(); var graphQLRequest = new GraphQLRequest("query clientUserAgent { clientUserAgent }"); - var response = await ChatClient.SendQueryAsync(graphQLRequest, () => new { clientUserAgent = string.Empty }).ConfigureAwait(false); + var response = await ChatClient.SendQueryAsync(graphQLRequest, () => new { clientUserAgent = string.Empty }); response.Errors.Should().BeNull(); response.Data.clientUserAgent.Should().Be(expectedUserAgent); @@ -60,7 +60,7 @@ public async void No_Default_user_agent_if_set_to_null() ChatClient = Fixture.GetChatClient(options => options.DefaultUserAgentRequestHeader = null); var graphQLRequest = new GraphQLRequest("query clientUserAgent { clientUserAgent }"); - var response = await ChatClient.SendQueryAsync(graphQLRequest, () => new { clientUserAgent = string.Empty }).ConfigureAwait(false); + var response = await ChatClient.SendQueryAsync(graphQLRequest, () => new { clientUserAgent = string.Empty }); response.Errors.Should().HaveCount(1); response.Errors[0].Message.Should().Be("user agent header not set"); diff --git a/tests/GraphQL.Integration.Tests/WebsocketTests/Base.cs b/tests/GraphQL.Integration.Tests/WebsocketTests/Base.cs index e16a4a38..98d4226d 100644 --- a/tests/GraphQL.Integration.Tests/WebsocketTests/Base.cs +++ b/tests/GraphQL.Integration.Tests/WebsocketTests/Base.cs @@ -121,7 +121,7 @@ query Long { // unblock the query chatQuery.LongRunningQueryBlocker.Set(); // check execution time - request.Invoke().Result.Data.longRunning.Should().Be("finally returned"); + (await request.Invoke()).Data.longRunning.Should().Be("finally returned"); // reset stuff chatQuery.LongRunningQueryBlocker.Reset(); diff --git a/tests/GraphQL.Integration.Tests/WebsocketTests/SystemTextJsonAutoNegotiate.cs b/tests/GraphQL.Integration.Tests/WebsocketTests/SystemTextJsonAutoNegotiate.cs index 0090e307..e6d72c90 100644 --- a/tests/GraphQL.Integration.Tests/WebsocketTests/SystemTextJsonAutoNegotiate.cs +++ b/tests/GraphQL.Integration.Tests/WebsocketTests/SystemTextJsonAutoNegotiate.cs @@ -15,7 +15,7 @@ public SystemTextJsonAutoNegotiate(ITestOutputHelper output, SystemTextJsonAutoN [Fact] public async Task WebSocketProtocolIsAutoNegotiated() { - await ChatClient.InitializeWebsocketConnection().ConfigureAwait(false); + await ChatClient.InitializeWebsocketConnection(); ChatClient.WebSocketSubProtocol.Should().Be(WebSocketProtocols.GRAPHQL_TRANSPORT_WS); } } diff --git a/tests/GraphQL.Integration.Tests/WebsocketTests/SystemTextJsonGraphQLTransportWs.cs b/tests/GraphQL.Integration.Tests/WebsocketTests/SystemTextJsonGraphQLTransportWs.cs index dfba089e..50fc92a0 100644 --- a/tests/GraphQL.Integration.Tests/WebsocketTests/SystemTextJsonGraphQLTransportWs.cs +++ b/tests/GraphQL.Integration.Tests/WebsocketTests/SystemTextJsonGraphQLTransportWs.cs @@ -15,21 +15,21 @@ public SystemTextJsonGraphQLTransportWs(ITestOutputHelper output, SystemTextJson [Fact] public async void Sending_a_pong_message_should_not_throw() { - await ChatClient.InitializeWebsocketConnection().ConfigureAwait(false); + await ChatClient.InitializeWebsocketConnection(); - await ChatClient.Awaiting(client => client.SendPongAsync(null)).Should().NotThrowAsync().ConfigureAwait(false); - await ChatClient.Awaiting(client => client.SendPongAsync("some payload")).Should().NotThrowAsync().ConfigureAwait(false); + await ChatClient.Awaiting(client => client.SendPongAsync(null)).Should().NotThrowAsync(); + await ChatClient.Awaiting(client => client.SendPongAsync("some payload")).Should().NotThrowAsync(); } [Fact] public async void Sending_a_ping_message_should_result_in_a_pong_message_from_the_server() { - await ChatClient.InitializeWebsocketConnection().ConfigureAwait(false); + await ChatClient.InitializeWebsocketConnection(); using var pongObserver = ChatClient.PongStream.Observe(); - await ChatClient.Awaiting(client => client.SendPingAsync(null)).Should().NotThrowAsync().ConfigureAwait(false); + await ChatClient.Awaiting(client => client.SendPingAsync(null)).Should().NotThrowAsync(); - await pongObserver.Should().PushAsync(1, TimeSpan.FromSeconds(1), "because the server was pinged by the client").ConfigureAwait(false); + await pongObserver.Should().PushAsync(1, TimeSpan.FromSeconds(1), "because the server was pinged by the client"); } } diff --git a/tests/GraphQL.Integration.Tests/WebsocketTests/SystemTextJsonGraphQLWs.cs b/tests/GraphQL.Integration.Tests/WebsocketTests/SystemTextJsonGraphQLWs.cs index 963f8292..b1efe0b1 100644 --- a/tests/GraphQL.Integration.Tests/WebsocketTests/SystemTextJsonGraphQLWs.cs +++ b/tests/GraphQL.Integration.Tests/WebsocketTests/SystemTextJsonGraphQLWs.cs @@ -14,25 +14,25 @@ public SystemTextJsonGraphQLWs(ITestOutputHelper output, SystemTextJsonGraphQLWs [Fact] public async void Sending_a_ping_message_should_throw_not_supported_exception() { - await ChatClient.InitializeWebsocketConnection().ConfigureAwait(false); + await ChatClient.InitializeWebsocketConnection(); await ChatClient.Awaiting(client => client.SendPingAsync(null)) - .Should().ThrowAsync().ConfigureAwait(false); + .Should().ThrowAsync(); } [Fact] public async void Sending_a_pong_message_should_throw_not_supported_exception() { - await ChatClient.InitializeWebsocketConnection().ConfigureAwait(false); + await ChatClient.InitializeWebsocketConnection(); await ChatClient.Awaiting(client => client.SendPongAsync(null)) - .Should().ThrowAsync().ConfigureAwait(false); + .Should().ThrowAsync(); } [Fact] public async void Subscribing_to_the_pong_stream_should_throw_not_supported_exception() { - await ChatClient.InitializeWebsocketConnection().ConfigureAwait(false); + await ChatClient.InitializeWebsocketConnection(); ChatClient.Invoking(client => client.PongStream.Subscribe()) .Should().Throw(); diff --git a/tests/GraphQL.Primitives.Tests/GraphQL.Primitives.Tests.csproj b/tests/GraphQL.Primitives.Tests/GraphQL.Primitives.Tests.csproj index 5210f214..ffe7c0a6 100644 --- a/tests/GraphQL.Primitives.Tests/GraphQL.Primitives.Tests.csproj +++ b/tests/GraphQL.Primitives.Tests/GraphQL.Primitives.Tests.csproj @@ -10,4 +10,13 @@ + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/tests/GraphQL.Primitives.Tests/GraphQLRequestTest.cs b/tests/GraphQL.Primitives.Tests/GraphQLRequestTest.cs index b56e6376..45560652 100644 --- a/tests/GraphQL.Primitives.Tests/GraphQLRequestTest.cs +++ b/tests/GraphQL.Primitives.Tests/GraphQLRequestTest.cs @@ -1,3 +1,4 @@ +using FluentAssertions; using Xunit; namespace GraphQL.Primitives.Tests; @@ -26,7 +27,7 @@ public void ConstructorExtendedFact() public void Equality1Fact() { var graphQLRequest = new GraphQLRequest("{hero{name}}"); - Assert.Equal(graphQLRequest, graphQLRequest); + graphQLRequest.Equals(graphQLRequest).Should().BeTrue(); } [Fact] @@ -34,7 +35,7 @@ public void Equality2Fact() { var graphQLRequest1 = new GraphQLRequest("{hero{name}}"); var graphQLRequest2 = new GraphQLRequest("{hero{name}}"); - Assert.Equal(graphQLRequest1, graphQLRequest2); + graphQLRequest1.Equals(graphQLRequest2).Should().BeTrue(); } [Fact] @@ -42,7 +43,7 @@ public void Equality3Fact() { var graphQLRequest1 = new GraphQLRequest("{hero{name}}", new { varName = "varValue" }, "operationName"); var graphQLRequest2 = new GraphQLRequest("{hero{name}}", new { varName = "varValue" }, "operationName"); - Assert.Equal(graphQLRequest1, graphQLRequest2); + graphQLRequest1.Equals(graphQLRequest2).Should().BeTrue(); } [Fact] @@ -66,7 +67,7 @@ public void InEquality1Fact() { var graphQLRequest1 = new GraphQLRequest("{hero{name1}}"); var graphQLRequest2 = new GraphQLRequest("{hero{name2}}"); - Assert.NotEqual(graphQLRequest1, graphQLRequest2); + graphQLRequest1.Equals(graphQLRequest2).Should().BeFalse(); } [Fact] @@ -74,7 +75,7 @@ public void InEquality2Fact() { var graphQLRequest1 = new GraphQLRequest("{hero{name}}", new { varName = "varValue1" }, "operationName"); var graphQLRequest2 = new GraphQLRequest("{hero{name}}", new { varName = "varValue2" }, "operationName"); - Assert.NotEqual(graphQLRequest1, graphQLRequest2); + graphQLRequest1.Equals(graphQLRequest2).Should().BeFalse(); } [Fact] diff --git a/tests/GraphQL.Server.Test/GraphQL.Server.Test.csproj b/tests/GraphQL.Server.Test/GraphQL.Server.Test.csproj index 4b81bde3..00d8126c 100644 --- a/tests/GraphQL.Server.Test/GraphQL.Server.Test.csproj +++ b/tests/GraphQL.Server.Test/GraphQL.Server.Test.csproj @@ -6,9 +6,9 @@ - - - + + + diff --git a/tests/IntegrationTestServer/IntegrationTestServer.csproj b/tests/IntegrationTestServer/IntegrationTestServer.csproj index 85b003c9..66d8071d 100644 --- a/tests/IntegrationTestServer/IntegrationTestServer.csproj +++ b/tests/IntegrationTestServer/IntegrationTestServer.csproj @@ -11,9 +11,9 @@ - - - + + +