From d539773b8b8992544a6c0e34210ec09ebc69b4d1 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 20 Nov 2023 20:30:53 +0100 Subject: [PATCH] Update SDK and nuget packages. --- .github/workflows/dotnet.yml | 1 + Directory.Packages.props | 38 +++++++++---------- .../Parsers/EmojiParser.cs | 2 +- .../InteractionDataExtensionsTests.cs | 4 +- .../MockedTransportSequenceBuilder.cs | 4 +- .../Transport/MockedTransportService.cs | 22 +++++------ global.json | 4 +- 7 files changed, 38 insertions(+), 37 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 3294a7bd1f..556320b60c 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -27,6 +27,7 @@ jobs: dotnet-version: | 6.0.x 7.0.x + 8.0.x - name: Build run: | diff --git a/Directory.Packages.props b/Directory.Packages.props index 0de47a3248..18e051db44 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,31 +7,31 @@ - - - - - - - - - + + + + + + + + + - + - - - - - - - + + + + + + + - - + + \ No newline at end of file diff --git a/Remora.Discord.Commands/Parsers/EmojiParser.cs b/Remora.Discord.Commands/Parsers/EmojiParser.cs index 918191dc74..de569a1bca 100644 --- a/Remora.Discord.Commands/Parsers/EmojiParser.cs +++ b/Remora.Discord.Commands/Parsers/EmojiParser.cs @@ -151,7 +151,7 @@ private static bool TryParseEmoji(string input, [NotNullWhen(true)] out IEmoji? return false; } - emoji = new Emoji(emojiID, inputParts[^2], IsAnimated: inputParts is["a", _, _]); + emoji = new Emoji(emojiID, inputParts[^2], IsAnimated: inputParts is ["a", _, _]); return true; } diff --git a/Tests/Remora.Discord.Commands.Tests/Extensions/InteractionDataExtensionsTests.cs b/Tests/Remora.Discord.Commands.Tests/Extensions/InteractionDataExtensionsTests.cs index dc04b4145f..54ca66e9cc 100644 --- a/Tests/Remora.Discord.Commands.Tests/Extensions/InteractionDataExtensionsTests.cs +++ b/Tests/Remora.Discord.Commands.Tests/Extensions/InteractionDataExtensionsTests.cs @@ -267,7 +267,7 @@ public void CanUnpackUserCommand() command.UnpackInteraction(out var commandPath, out var parameters); Assert.Equal(new[] { "user" }, commandPath); - Assert.Equal(1, parameters.Count); + Assert.Single(parameters); Assert.True(parameters.ContainsKey("user")); Assert.Equal("1", parameters["user"][0]); } @@ -289,7 +289,7 @@ public void CanUnpackMessageCommand() command.UnpackInteraction(out var commandPath, out var parameters); Assert.Equal(new[] { "message" }, commandPath); - Assert.Equal(1, parameters.Count); + Assert.Single(parameters); Assert.True(parameters.ContainsKey("message")); Assert.Equal("1", parameters["message"][0]); } diff --git a/Tests/Remora.Discord.Gateway.Tests/Transport/MockedTransportSequenceBuilder.cs b/Tests/Remora.Discord.Gateway.Tests/Transport/MockedTransportSequenceBuilder.cs index 01bd29f6bc..ef9831d5cd 100644 --- a/Tests/Remora.Discord.Gateway.Tests/Transport/MockedTransportSequenceBuilder.cs +++ b/Tests/Remora.Discord.Gateway.Tests/Transport/MockedTransportSequenceBuilder.cs @@ -59,7 +59,7 @@ public MockedTransportSequenceBuilder ExpectConnection(Uri? connectionUri = null if (connectionUri != u) { - throw new EqualException(connectionUri, u); + throw EqualException.ForMismatchedValues(connectionUri, u); } return EventMatch.Pass; @@ -106,7 +106,7 @@ public MockedTransportSequenceBuilder Expect(Func? ? p.GetType().GetGenericArguments()[0].Name : p.GetType().Name; - throw new IsTypeException(typeof(TExpected).Name, actualTypename); + throw IsTypeException.ForMismatchedType(typeof(TExpected).Name, actualTypename); } if (expectation is null) diff --git a/Tests/Remora.Discord.Gateway.Tests/Transport/MockedTransportService.cs b/Tests/Remora.Discord.Gateway.Tests/Transport/MockedTransportService.cs index 2c5e73f46f..f812fa03ff 100644 --- a/Tests/Remora.Discord.Gateway.Tests/Transport/MockedTransportService.cs +++ b/Tests/Remora.Discord.Gateway.Tests/Transport/MockedTransportService.cs @@ -113,7 +113,7 @@ public async Task ConnectAsync(Uri endpoint, CancellationToken ct = defa } case EventMatch.Fail: { - throw new TrueException("An event in a sequence failed.", null); + throw TrueException.ForNonTrueValue("An event in a sequence failed.", null); } case EventMatch.Ignore: { @@ -148,7 +148,7 @@ public async Task ConnectAsync(Uri endpoint, CancellationToken ct = defa } case EventMatch.Fail: { - throw new TrueException("An event in a continuous sequence failed.", null); + throw TrueException.ForNonTrueValue("An event in a continuous sequence failed.", null); } case EventMatch.Ignore: { @@ -165,7 +165,7 @@ public async Task ConnectAsync(Uri endpoint, CancellationToken ct = defa var remainingSequences = _sequences.Except(_finishedSequences).ToList(); if (remainingSequences.Count == 0) { - _finisher.Cancel(); + await _finisher.CancelAsync(); } if (!sequenceAdvanced) @@ -215,7 +215,7 @@ public async ValueTask SendPayloadAsync(IPayload payload, CancellationTo } case EventMatch.Fail: { - throw new TrueException("An event in a sequence failed.", null); + throw TrueException.ForNonTrueValue("An event in a sequence failed.", null); } case EventMatch.Ignore: { @@ -255,7 +255,7 @@ public async ValueTask SendPayloadAsync(IPayload payload, CancellationTo } case EventMatch.Fail: { - throw new TrueException("An event in a continuous sequence failed.", null); + throw TrueException.ForNonTrueValue("An event in a continuous sequence failed.", null); } case EventMatch.Ignore: { @@ -272,13 +272,13 @@ public async ValueTask SendPayloadAsync(IPayload payload, CancellationTo if (!hadExpectedEvent && !_serviceOptions.IgnoreUnexpected) { - throw new IsTypeException("[sequence]", payload.GetType().ToString()); + throw IsTypeException.ForMismatchedType("[sequence]", payload.GetType().ToString()); } var remainingSequences = _sequences.Except(_finishedSequences).ToList(); if (remainingSequences.Count == 0) { - _finisher.Cancel(); + await _finisher.CancelAsync(); } if (!sequenceAdvanced) @@ -362,7 +362,7 @@ public async ValueTask> ReceivePayloadAsync(CancellationToken c var remainingSequences = _sequences.Except(_finishedSequences).ToList(); if (remainingSequences.Count == 0) { - _finisher.Cancel(); + await _finisher.CancelAsync(); } if (!sequenceAdvanced) @@ -421,7 +421,7 @@ public async Task DisconnectAsync } case EventMatch.Fail: { - throw new TrueException("An event in a sequence failed.", null); + throw TrueException.ForNonTrueValue("An event in a sequence failed.", null); } case EventMatch.Ignore: { @@ -456,7 +456,7 @@ public async Task DisconnectAsync } case EventMatch.Fail: { - throw new TrueException("An event in a continuous sequence failed.", null); + throw TrueException.ForNonTrueValue("An event in a continuous sequence failed.", null); } case EventMatch.Ignore: { @@ -473,7 +473,7 @@ public async Task DisconnectAsync var remainingSequences = _sequences.Except(_finishedSequences).ToList(); if (remainingSequences.Count == 0) { - _finisher.Cancel(); + await _finisher.CancelAsync(); } if (!sequenceAdvanced) diff --git a/global.json b/global.json index 0c90e7a9b2..c5ac4f09fa 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "msbuild-sdks": { - "Remora.Sdk": "2.1.1", - "Remora.Tests.Sdk": "2.0.5" + "Remora.Sdk": "3.0.1", + "Remora.Tests.Sdk": "3.0.1" } }