diff --git a/ArchiSteamFarm.Tests/ArchiSteamFarm.Tests.csproj b/ArchiSteamFarm.Tests/ArchiSteamFarm.Tests.csproj index aac6183f8..bac9e61f9 100644 --- a/ArchiSteamFarm.Tests/ArchiSteamFarm.Tests.csproj +++ b/ArchiSteamFarm.Tests/ArchiSteamFarm.Tests.csproj @@ -6,9 +6,7 @@ - - - + diff --git a/ArchiSteamFarm.Tests/Bot.cs b/ArchiSteamFarm.Tests/Bot.cs index 920a80c3e..a3491029a 100644 --- a/ArchiSteamFarm.Tests/Bot.cs +++ b/ArchiSteamFarm.Tests/Bot.cs @@ -55,7 +55,6 @@ public sealed class Bot { } [TestMethod] - [ExpectedException(typeof(ArgumentOutOfRangeException))] public void MaxItemsTooSmall() { const uint appID = 42; @@ -64,9 +63,7 @@ public sealed class Bot { CreateCard(2, appID) ]; - GetItemsForFullBadge(items, 2, appID, MinCardsPerBadge - 1); - - Assert.Fail(); + Assert.ThrowsException(() => GetItemsForFullBadge(items, 2, appID, MinCardsPerBadge - 1)); } [TestMethod] @@ -460,7 +457,6 @@ public sealed class Bot { } [TestMethod] - [ExpectedException(typeof(InvalidOperationException))] public void TooManyCardsPerSet() { const uint appID0 = 42; const uint appID1 = 43; @@ -473,15 +469,15 @@ public sealed class Bot { CreateCard(4, appID0) ]; - GetItemsForFullBadge( - items, new Dictionary { - { appID0, 3 }, - { appID1, 3 }, - { appID2, 3 } - } + Assert.ThrowsException( + () => GetItemsForFullBadge( + items, new Dictionary { + { appID0, 3 }, + { appID1, 3 }, + { appID2, 3 } + } + ) ); - - Assert.Fail(); } private static void AssertResultMatchesExpectation(IReadOnlyDictionary<(uint RealAppID, ulong ContextID, ulong ClassID), uint> expectedResult, IReadOnlyCollection itemsToSend) { diff --git a/ArchiSteamFarm.Tests/SteamChatMessage.cs b/ArchiSteamFarm.Tests/SteamChatMessage.cs index a8efb51bc..830781d94 100644 --- a/ArchiSteamFarm.Tests/SteamChatMessage.cs +++ b/ArchiSteamFarm.Tests/SteamChatMessage.cs @@ -311,27 +311,21 @@ public sealed class SteamChatMessage { Assert.AreEqual(newlinePart, output[3]); } - [ExpectedException(typeof(ArgumentOutOfRangeException))] [TestMethod] public async Task ThrowsOnTooLongNewlinesPrefix() { string prefix = new('\n', (MaxMessagePrefixBytes / NewlineWeight) + 1); const string message = "asdf"; - await GetMessageParts(message, prefix).ToListAsync().ConfigureAwait(false); - - Assert.Fail(); + await Assert.ThrowsExceptionAsync(async () => await GetMessageParts(message, prefix).ToListAsync().ConfigureAwait(false)).ConfigureAwait(false); } - [ExpectedException(typeof(ArgumentOutOfRangeException))] [TestMethod] public async Task ThrowsOnTooLongPrefix() { string prefix = new('x', MaxMessagePrefixBytes + 1); const string message = "asdf"; - await GetMessageParts(message, prefix).ToListAsync().ConfigureAwait(false); - - Assert.Fail(); + await Assert.ThrowsExceptionAsync(async () => await GetMessageParts(message, prefix).ToListAsync().ConfigureAwait(false)).ConfigureAwait(false); } } diff --git a/Directory.Packages.props b/Directory.Packages.props index 0a42fcd64..6f8b91beb 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,9 +7,7 @@ - - - +