From ceb007500db16853dd9fac61a1ef8e76f428a7ea Mon Sep 17 00:00:00 2001 From: Michael Bucari-Tovo Date: Thu, 14 Aug 2025 15:58:01 -0600 Subject: [PATCH] Update assertions to use ThrowsExactly --- Source/_Tests/AudibleUtilities.Tests/AccountTests.cs | 4 ++-- Source/_Tests/FileManager.Tests/FileUtilityTests.cs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/_Tests/AudibleUtilities.Tests/AccountTests.cs b/Source/_Tests/AudibleUtilities.Tests/AccountTests.cs index 03309832..f45a850f 100644 --- a/Source/_Tests/AudibleUtilities.Tests/AccountTests.cs +++ b/Source/_Tests/AudibleUtilities.Tests/AccountTests.cs @@ -528,7 +528,7 @@ namespace AccountsTests var a2 = new Account("a") { AccountName = "two", IdentityTokens = idIn }; // violation: validate() - Assert.ThrowsException(() => accountsSettings.Add(a2)); + Assert.ThrowsExactly(() => accountsSettings.Add(a2)); } [TestMethod] @@ -545,7 +545,7 @@ namespace AccountsTests accountsSettings.Add(a2); // violation: GetAccount.SingleOrDefault - Assert.ThrowsException(() => a2.IdentityTokens = idIn); + Assert.ThrowsExactly(() => a2.IdentityTokens = idIn); } } diff --git a/Source/_Tests/FileManager.Tests/FileUtilityTests.cs b/Source/_Tests/FileManager.Tests/FileUtilityTests.cs index ff0e9f58..0b3dcafc 100644 --- a/Source/_Tests/FileManager.Tests/FileUtilityTests.cs +++ b/Source/_Tests/FileManager.Tests/FileUtilityTests.cs @@ -17,7 +17,7 @@ namespace FileUtilityTests static readonly ReplacementCharacters Barebones = ReplacementCharacters.Barebones(Environment.OSVersion.Platform == PlatformID.Win32NT); [TestMethod] - public void null_path_throws() => Assert.ThrowsException(() => FileUtility.GetSafePath(null, Default)); + public void null_path_throws() => Assert.ThrowsExactly(() => FileUtility.GetSafePath(null, Default)); [TestMethod] // non-empty replacement @@ -137,25 +137,25 @@ namespace FileUtilityTests public class GetSequenceFormatted { [TestMethod] - public void negative_partsPosition() => Assert.ThrowsException(() + public void negative_partsPosition() => Assert.ThrowsExactly(() => FileUtility.GetSequenceFormatted(-1, 2) ); [TestMethod] - public void zero_partsPosition() => Assert.ThrowsException(() + public void zero_partsPosition() => Assert.ThrowsExactly(() => FileUtility.GetSequenceFormatted(0, 2) ); [TestMethod] - public void negative_partsTotal() => Assert.ThrowsException(() + public void negative_partsTotal() => Assert.ThrowsExactly(() => FileUtility.GetSequenceFormatted(2, -1) ); [TestMethod] - public void zero_partsTotal() => Assert.ThrowsException(() + public void zero_partsTotal() => Assert.ThrowsExactly(() => FileUtility.GetSequenceFormatted(2, 0) ); [TestMethod] - public void partsPosition_greater_than_partsTotal() => Assert.ThrowsException(() + public void partsPosition_greater_than_partsTotal() => Assert.ThrowsExactly(() => FileUtility.GetSequenceFormatted(2, 1) );