diff --git a/Source/Libation.sln b/Source/Libation.sln index 20a54d45..024fb96a 100644 --- a/Source/Libation.sln +++ b/Source/Libation.sln @@ -102,6 +102,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libation UI", "Libation UI" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libation CLI", "Libation CLI", "{47E27674-595D-4F7A-8CFB-127E768E1D1E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssertionHelper", "_Tests\AssertionHelper\AssertionHelper.csproj", "{CFE7A0E5-37FE-40BE-A70B-41B5104181C4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -220,6 +222,10 @@ Global {E90C4651-AF11-41B4-A839-10082D0391F9}.Debug|Any CPU.Build.0 = Debug|Any CPU {E90C4651-AF11-41B4-A839-10082D0391F9}.Release|Any CPU.ActiveCfg = Release|Any CPU {E90C4651-AF11-41B4-A839-10082D0391F9}.Release|Any CPU.Build.0 = Release|Any CPU + {CFE7A0E5-37FE-40BE-A70B-41B5104181C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CFE7A0E5-37FE-40BE-A70B-41B5104181C4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CFE7A0E5-37FE-40BE-A70B-41B5104181C4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CFE7A0E5-37FE-40BE-A70B-41B5104181C4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -258,6 +264,7 @@ Global {FDDABAFE-35AD-42FC-AC95-0B1FE0DF0DDE} = {8679CAC8-9164-4007-BDD2-F004810EDA14} {53758A35-1C7E-4702-9B96-433ABA457B37} = {8679CAC8-9164-4007-BDD2-F004810EDA14} {47E27674-595D-4F7A-8CFB-127E768E1D1E} = {8679CAC8-9164-4007-BDD2-F004810EDA14} + {CFE7A0E5-37FE-40BE-A70B-41B5104181C4} = {67E66E82-5532-4440-AFB3-9FB1DF9DEF53} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {615E00ED-BAEF-4E8E-A92A-9B82D87942A9} diff --git a/Source/_Tests/AssertionHelper/AssertionExtensions.cs b/Source/_Tests/AssertionHelper/AssertionExtensions.cs new file mode 100644 index 00000000..c314c614 --- /dev/null +++ b/Source/_Tests/AssertionHelper/AssertionExtensions.cs @@ -0,0 +1,37 @@ +using System.Diagnostics; + +namespace AssertionHelper; + +public static class AssertionExtensions +{ + [StackTraceHidden] + public static T? Should(this T? value) => value; + + [StackTraceHidden] + public static void Be(this T? value, T? expectedValue) where T : IEquatable + => Assert.AreEqual(value, expectedValue); + + [StackTraceHidden] + public static void BeNull(this T? value) where T : class + => Assert.IsNull(value); + + [StackTraceHidden] + public static void BeSameAs(this T? value, T? otherValue) + => Assert.AreSame(value, otherValue); + + [StackTraceHidden] + public static void BeFalse(this bool value) + => Assert.IsFalse(value); + + [StackTraceHidden] + public static void BeTrue(this bool value) + => Assert.IsTrue(value); + + [StackTraceHidden] + public static void HaveCount(this IEnumerable value, int expected) + => Assert.HasCount(expected, value); + + [StackTraceHidden] + public static void BeEquivalentTo(this IEnumerable? value, IEnumerable? expectedValue) + => CollectionAssert.AreEquivalent(value, expectedValue, EqualityComparer.Default); +} diff --git a/Source/_Tests/AssertionHelper/AssertionHelper.csproj b/Source/_Tests/AssertionHelper/AssertionHelper.csproj new file mode 100644 index 00000000..7f3ad5da --- /dev/null +++ b/Source/_Tests/AssertionHelper/AssertionHelper.csproj @@ -0,0 +1,14 @@ + + + + net9.0 + enable + enable + + + + + + + + diff --git a/Source/_Tests/AudibleUtilities.Tests/AccountTests.cs b/Source/_Tests/AudibleUtilities.Tests/AccountTests.cs index f45a850f..8a40991f 100644 --- a/Source/_Tests/AudibleUtilities.Tests/AccountTests.cs +++ b/Source/_Tests/AudibleUtilities.Tests/AccountTests.cs @@ -1,21 +1,11 @@ using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; +using AssertionHelper; using AudibleApi; using AudibleApi.Authorization; using AudibleUtilities; -using Dinah.Core; -using FluentAssertions; -using FluentAssertions.Common; -using Microsoft.VisualStudio.TestPlatform.Common.Filtering; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace AccountsTests { diff --git a/Source/_Tests/AudibleUtilities.Tests/AudibleUtilities.Tests.csproj b/Source/_Tests/AudibleUtilities.Tests/AudibleUtilities.Tests.csproj index 31bc85af..76ac21e6 100644 --- a/Source/_Tests/AudibleUtilities.Tests/AudibleUtilities.Tests.csproj +++ b/Source/_Tests/AudibleUtilities.Tests/AudibleUtilities.Tests.csproj @@ -1,4 +1,4 @@ - + net9.0 @@ -6,10 +6,7 @@ - - - all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -18,6 +15,7 @@ + diff --git a/Source/_Tests/FileLiberator.Tests/DownloadDecryptBookTests.cs b/Source/_Tests/FileLiberator.Tests/DownloadDecryptBookTests.cs index fac89148..d6f64d9c 100644 --- a/Source/_Tests/FileLiberator.Tests/DownloadDecryptBookTests.cs +++ b/Source/_Tests/FileLiberator.Tests/DownloadDecryptBookTests.cs @@ -1,14 +1,8 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; +using System.Collections.Generic; +using AssertionHelper; using AudibleApi.Common; -using Dinah.Core; -using FileManager; -using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; - namespace FileLiberator.Tests { [TestClass] diff --git a/Source/_Tests/FileLiberator.Tests/FileLiberator.Tests.csproj b/Source/_Tests/FileLiberator.Tests/FileLiberator.Tests.csproj index 056bb344..8f0982e2 100644 --- a/Source/_Tests/FileLiberator.Tests/FileLiberator.Tests.csproj +++ b/Source/_Tests/FileLiberator.Tests/FileLiberator.Tests.csproj @@ -6,10 +6,7 @@ - - - all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -18,6 +15,7 @@ + diff --git a/Source/_Tests/FileManager.Tests/FileManager.Tests.csproj b/Source/_Tests/FileManager.Tests/FileManager.Tests.csproj index 2791941c..b2973d87 100644 --- a/Source/_Tests/FileManager.Tests/FileManager.Tests.csproj +++ b/Source/_Tests/FileManager.Tests/FileManager.Tests.csproj @@ -1,4 +1,4 @@ - + net9.0 @@ -7,10 +7,7 @@ - - - all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -19,6 +16,7 @@ + diff --git a/Source/_Tests/FileManager.Tests/FileNamingTemplateTests.cs b/Source/_Tests/FileManager.Tests/FileNamingTemplateTests.cs index fccffc91..65dc1218 100644 --- a/Source/_Tests/FileManager.Tests/FileNamingTemplateTests.cs +++ b/Source/_Tests/FileManager.Tests/FileNamingTemplateTests.cs @@ -1,6 +1,6 @@ using System.Linq; +using AssertionHelper; using FileManager.NamingTemplate; -using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace NamingTemplateTests diff --git a/Source/_Tests/FileManager.Tests/FileUtilityTests.cs b/Source/_Tests/FileManager.Tests/FileUtilityTests.cs index 0b3dcafc..4cc67b30 100644 --- a/Source/_Tests/FileManager.Tests/FileUtilityTests.cs +++ b/Source/_Tests/FileManager.Tests/FileUtilityTests.cs @@ -1,10 +1,6 @@ using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Dinah.Core; +using AssertionHelper; using FileManager; -using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace FileUtilityTests diff --git a/Source/_Tests/LibationFileManager.Tests/LibationFileManager.Tests.csproj b/Source/_Tests/LibationFileManager.Tests/LibationFileManager.Tests.csproj index d89e59b0..2e9c8b73 100644 --- a/Source/_Tests/LibationFileManager.Tests/LibationFileManager.Tests.csproj +++ b/Source/_Tests/LibationFileManager.Tests/LibationFileManager.Tests.csproj @@ -7,10 +7,7 @@ - - - all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -19,6 +16,7 @@ + diff --git a/Source/_Tests/LibationFileManager.Tests/TemplatesTests.cs b/Source/_Tests/LibationFileManager.Tests/TemplatesTests.cs index 15da05ea..bbee3c80 100644 --- a/Source/_Tests/LibationFileManager.Tests/TemplatesTests.cs +++ b/Source/_Tests/LibationFileManager.Tests/TemplatesTests.cs @@ -2,10 +2,9 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using Dinah.Core; +using AssertionHelper; using FileManager; using FileManager.NamingTemplate; -using FluentAssertions; using LibationFileManager.Templates; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/Source/_Tests/LibationSearchEngine.Tests/LibationSearchEngine.Tests.csproj b/Source/_Tests/LibationSearchEngine.Tests/LibationSearchEngine.Tests.csproj index ec4e83fe..28b5897c 100644 --- a/Source/_Tests/LibationSearchEngine.Tests/LibationSearchEngine.Tests.csproj +++ b/Source/_Tests/LibationSearchEngine.Tests/LibationSearchEngine.Tests.csproj @@ -7,10 +7,7 @@ - - - all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -19,6 +16,7 @@ + diff --git a/Source/_Tests/LibationSearchEngine.Tests/SearchEngineTests.cs b/Source/_Tests/LibationSearchEngine.Tests/SearchEngineTests.cs index 492627f6..eb62fd52 100644 --- a/Source/_Tests/LibationSearchEngine.Tests/SearchEngineTests.cs +++ b/Source/_Tests/LibationSearchEngine.Tests/SearchEngineTests.cs @@ -1,20 +1,7 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Dinah.Core; -using FluentAssertions; -using FluentAssertions.Common; +using AssertionHelper; using LibationSearchEngine; using Lucene.Net.Analysis.Standard; -using Microsoft.VisualStudio.TestPlatform.Common.Filtering; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace SearchEngineTests {