From 51d075274c480e4496a7549c487213d4af629a6e Mon Sep 17 00:00:00 2001 From: Rick Neeft Date: Sun, 1 Dec 2024 14:51:06 +0100 Subject: [PATCH 1/7] update git ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 8a30d25..a53dc95 100644 --- a/.gitignore +++ b/.gitignore @@ -396,3 +396,4 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml +.idea/* \ No newline at end of file From 652c8177ede87d67583ae30ef23c8a6e4cd4a172 Mon Sep 17 00:00:00 2001 From: Rick Neeft Date: Sun, 1 Dec 2024 14:56:21 +0100 Subject: [PATCH 2/7] Upgrade to .NET 9 + Package update --- .../Top2000.Features.SQLite.csproj | 4 +- src/Top2000.Features/Top2000.Features.csproj | 2 +- .../Top2000.Features.SQLite.Unittests.csproj | 10 +-- tests/Top2000.Features.Specs/App.cs | 8 ++- .../Features/AllEditions.feature.cs | 20 +++--- .../Features/AllListingsOfEdition.feature.cs | 24 ++++--- .../Features/ClientDatabase.feature.cs | 36 +++++----- .../Features/Search.feature.cs | 20 +++--- .../Features/Top2000Data.feature.cs | 44 ++++++------ .../Features/TrackInformation.feature.cs | 70 +++++++++---------- .../Top2000.Features.Specs.csproj | 16 ++--- .../Top2000.Features.Tests.csproj | 10 +-- 12 files changed, 140 insertions(+), 124 deletions(-) diff --git a/src/SQLite/Top2000.Features.SQLite/Top2000.Features.SQLite.csproj b/src/SQLite/Top2000.Features.SQLite/Top2000.Features.SQLite.csproj index ebe6ebc..793908b 100644 --- a/src/SQLite/Top2000.Features.SQLite/Top2000.Features.SQLite.csproj +++ b/src/SQLite/Top2000.Features.SQLite/Top2000.Features.SQLite.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 enable enable @@ -28,7 +28,7 @@ - + diff --git a/src/Top2000.Features/Top2000.Features.csproj b/src/Top2000.Features/Top2000.Features.csproj index 730e079..fef9373 100644 --- a/src/Top2000.Features/Top2000.Features.csproj +++ b/src/Top2000.Features/Top2000.Features.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 enable enable diff --git a/tests/SQLite/Top2000.Features.SQLite.Unittests/Top2000.Features.SQLite.Unittests.csproj b/tests/SQLite/Top2000.Features.SQLite.Unittests/Top2000.Features.SQLite.Unittests.csproj index 8d6581e..fa4de21 100644 --- a/tests/SQLite/Top2000.Features.SQLite.Unittests/Top2000.Features.SQLite.Unittests.csproj +++ b/tests/SQLite/Top2000.Features.SQLite.Unittests/Top2000.Features.SQLite.Unittests.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 enable enable @@ -14,11 +14,11 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - - + + diff --git a/tests/Top2000.Features.Specs/App.cs b/tests/Top2000.Features.Specs/App.cs index 17bd8eb..0e7ad45 100644 --- a/tests/Top2000.Features.Specs/App.cs +++ b/tests/Top2000.Features.Specs/App.cs @@ -19,7 +19,13 @@ public static class App public static void BeforeTestRun() { var services = new ServiceCollection() - .AddClientDatabase(new DirectoryInfo(Directory.GetCurrentDirectory()), "top2000_unittest.db") + .AddTop2000(builder => + { + builder + .DatabaseDirectory(Directory.GetCurrentDirectory()) + .DatabaseName("top2000_unittest.db") + .EnableOnlineUpdates(); + }) .AddFeaturesWithSQLite() ; diff --git a/tests/Top2000.Features.Specs/Features/AllEditions.feature.cs b/tests/Top2000.Features.Specs/Features/AllEditions.feature.cs index e2717a1..a4762fa 100644 --- a/tests/Top2000.Features.Specs/Features/AllEditions.feature.cs +++ b/tests/Top2000.Features.Specs/Features/AllEditions.feature.cs @@ -23,12 +23,14 @@ namespace Top2000.Features.Specs.Features public partial class AllEditionsFeature { - private static global::Reqnroll.ITestRunner testRunner; + private global::Reqnroll.ITestRunner testRunner; private Microsoft.VisualStudio.TestTools.UnitTesting.TestContext _testContext; private static string[] featureTags = ((string[])(null)); + private static global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Features", "All Editions", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags); + #line 1 "AllEditions.feature" #line hidden @@ -47,26 +49,25 @@ public virtual Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestCont [Microsoft.VisualStudio.TestTools.UnitTesting.ClassInitializeAttribute()] public static async System.Threading.Tasks.Task FeatureSetupAsync(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext) { - testRunner = global::Reqnroll.TestRunnerManager.GetTestRunnerForAssembly(); - global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Features", "All Editions", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags); - await testRunner.OnFeatureStartAsync(featureInfo); } [Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute(Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfClass)] public static async System.Threading.Tasks.Task FeatureTearDownAsync() { - await testRunner.OnFeatureEndAsync(); - global::Reqnroll.TestRunnerManager.ReleaseTestRunner(testRunner); - testRunner = null; } [Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute()] public async System.Threading.Tasks.Task TestInitializeAsync() { + testRunner = global::Reqnroll.TestRunnerManager.GetTestRunnerForAssembly(featureHint: featureInfo); if (((testRunner.FeatureContext != null) - && (testRunner.FeatureContext.FeatureInfo.Title != "All Editions"))) + && (testRunner.FeatureContext.FeatureInfo.Equals(featureInfo) == false))) { - await global::Top2000.Features.Specs.Features.AllEditionsFeature.FeatureSetupAsync(null); + await testRunner.OnFeatureEndAsync(); + } + if ((testRunner.FeatureContext == null)) + { + await testRunner.OnFeatureStartAsync(featureInfo); } } @@ -74,6 +75,7 @@ public async System.Threading.Tasks.Task TestInitializeAsync() public async System.Threading.Tasks.Task TestTearDownAsync() { await testRunner.OnScenarioEndAsync(); + global::Reqnroll.TestRunnerManager.ReleaseTestRunner(testRunner); } public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo) diff --git a/tests/Top2000.Features.Specs/Features/AllListingsOfEdition.feature.cs b/tests/Top2000.Features.Specs/Features/AllListingsOfEdition.feature.cs index cbb3d28..5976e06 100644 --- a/tests/Top2000.Features.Specs/Features/AllListingsOfEdition.feature.cs +++ b/tests/Top2000.Features.Specs/Features/AllListingsOfEdition.feature.cs @@ -23,12 +23,14 @@ namespace Top2000.Features.Specs.Features public partial class AllListingsOfEditionFeature { - private static global::Reqnroll.ITestRunner testRunner; + private global::Reqnroll.ITestRunner testRunner; private Microsoft.VisualStudio.TestTools.UnitTesting.TestContext _testContext; private static string[] featureTags = ((string[])(null)); + private static global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Features", "AllListingsOfEdition", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags); + #line 1 "AllListingsOfEdition.feature" #line hidden @@ -47,26 +49,25 @@ public virtual Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestCont [Microsoft.VisualStudio.TestTools.UnitTesting.ClassInitializeAttribute()] public static async System.Threading.Tasks.Task FeatureSetupAsync(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext) { - testRunner = global::Reqnroll.TestRunnerManager.GetTestRunnerForAssembly(); - global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Features", "AllListingsOfEdition", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags); - await testRunner.OnFeatureStartAsync(featureInfo); } [Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute(Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfClass)] public static async System.Threading.Tasks.Task FeatureTearDownAsync() { - await testRunner.OnFeatureEndAsync(); - global::Reqnroll.TestRunnerManager.ReleaseTestRunner(testRunner); - testRunner = null; } [Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute()] public async System.Threading.Tasks.Task TestInitializeAsync() { + testRunner = global::Reqnroll.TestRunnerManager.GetTestRunnerForAssembly(featureHint: featureInfo); if (((testRunner.FeatureContext != null) - && (testRunner.FeatureContext.FeatureInfo.Title != "AllListingsOfEdition"))) + && (testRunner.FeatureContext.FeatureInfo.Equals(featureInfo) == false))) { - await global::Top2000.Features.Specs.Features.AllListingsOfEditionFeature.FeatureSetupAsync(null); + await testRunner.OnFeatureEndAsync(); + } + if ((testRunner.FeatureContext == null)) + { + await testRunner.OnFeatureStartAsync(featureInfo); } } @@ -74,6 +75,7 @@ public async System.Threading.Tasks.Task TestInitializeAsync() public async System.Threading.Tasks.Task TestTearDownAsync() { await testRunner.OnScenarioEndAsync(); + global::Reqnroll.TestRunnerManager.ReleaseTestRunner(testRunner); } public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo) @@ -99,8 +101,8 @@ public async System.Threading.Tasks.Task In1998TheTop2000DidNotExist() { string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("In 1998 the Top2000 did not exist", "Background: the system won\'t throw an exception when the year since found. \r\nIt i" + - "s the responsibilty of the caller to make sure the year exist. ", tagsOfScenario, argumentsOfScenario, featureTags); + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("In 1998 the Top2000 did not exist", ("Background: the system won\'t throw an exception when the year since found. \nIt is" + + " the responsibilty of the caller to make sure the year exist. "), tagsOfScenario, argumentsOfScenario, featureTags); #line 3 this.ScenarioInitialize(scenarioInfo); #line hidden diff --git a/tests/Top2000.Features.Specs/Features/ClientDatabase.feature.cs b/tests/Top2000.Features.Specs/Features/ClientDatabase.feature.cs index b3b3916..e4aa8e9 100644 --- a/tests/Top2000.Features.Specs/Features/ClientDatabase.feature.cs +++ b/tests/Top2000.Features.Specs/Features/ClientDatabase.feature.cs @@ -23,12 +23,14 @@ namespace Top2000.Features.Specs.Features public partial class ClientDatabaseFeature { - private static global::Reqnroll.ITestRunner testRunner; + private global::Reqnroll.ITestRunner testRunner; private Microsoft.VisualStudio.TestTools.UnitTesting.TestContext _testContext; private static string[] featureTags = ((string[])(null)); + private static global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Features", "Client database", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags); + #line 1 "ClientDatabase.feature" #line hidden @@ -47,26 +49,25 @@ public virtual Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestCont [Microsoft.VisualStudio.TestTools.UnitTesting.ClassInitializeAttribute()] public static async System.Threading.Tasks.Task FeatureSetupAsync(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext) { - testRunner = global::Reqnroll.TestRunnerManager.GetTestRunnerForAssembly(); - global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Features", "Client database", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags); - await testRunner.OnFeatureStartAsync(featureInfo); } [Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute(Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfClass)] public static async System.Threading.Tasks.Task FeatureTearDownAsync() { - await testRunner.OnFeatureEndAsync(); - global::Reqnroll.TestRunnerManager.ReleaseTestRunner(testRunner); - testRunner = null; } [Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute()] public async System.Threading.Tasks.Task TestInitializeAsync() { + testRunner = global::Reqnroll.TestRunnerManager.GetTestRunnerForAssembly(featureHint: featureInfo); if (((testRunner.FeatureContext != null) - && (testRunner.FeatureContext.FeatureInfo.Title != "Client database"))) + && (testRunner.FeatureContext.FeatureInfo.Equals(featureInfo) == false))) { - await global::Top2000.Features.Specs.Features.ClientDatabaseFeature.FeatureSetupAsync(null); + await testRunner.OnFeatureEndAsync(); + } + if ((testRunner.FeatureContext == null)) + { + await testRunner.OnFeatureStartAsync(featureInfo); } } @@ -74,6 +75,7 @@ public async System.Threading.Tasks.Task TestInitializeAsync() public async System.Threading.Tasks.Task TestTearDownAsync() { await testRunner.OnScenarioEndAsync(); + global::Reqnroll.TestRunnerManager.ReleaseTestRunner(testRunner); } public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo) @@ -167,15 +169,15 @@ public async System.Threading.Tasks.Task ClientDatabaseIsUpdatedUponStartupWhenN } [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Client database is updated upon startup when new scripts are shipped on the Top20" + - "00 website.")] + [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(("Client database is updated upon startup when new scripts are shipped on the Top20" + + "00 website."))] [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Client database")] public async System.Threading.Tasks.Task ClientDatabaseIsUpdatedUponStartupWhenNewScriptsAreShippedOnTheTop2000Website_() { string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Client database is updated upon startup when new scripts are shipped on the Top20" + - "00 website.", null, tagsOfScenario, argumentsOfScenario, featureTags); + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo(("Client database is updated upon startup when new scripts are shipped on the Top20" + + "00 website."), null, tagsOfScenario, argumentsOfScenario, featureTags); #line 24 this.ScenarioInitialize(scenarioInfo); #line hidden @@ -206,15 +208,15 @@ public async System.Threading.Tasks.Task ClientDatabaseIsUpdatedUponStartupWhenN } [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Client database is updated when new scripts are shipped in the assembly and the T" + - "op2000 website.")] + [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(("Client database is updated when new scripts are shipped in the assembly and the T" + + "op2000 website."))] [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Client database")] public async System.Threading.Tasks.Task ClientDatabaseIsUpdatedWhenNewScriptsAreShippedInTheAssemblyAndTheTop2000Website_() { string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Client database is updated when new scripts are shipped in the assembly and the T" + - "op2000 website.", null, tagsOfScenario, argumentsOfScenario, featureTags); + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo(("Client database is updated when new scripts are shipped in the assembly and the T" + + "op2000 website."), null, tagsOfScenario, argumentsOfScenario, featureTags); #line 30 this.ScenarioInitialize(scenarioInfo); #line hidden diff --git a/tests/Top2000.Features.Specs/Features/Search.feature.cs b/tests/Top2000.Features.Specs/Features/Search.feature.cs index 7f8e9e0..1d97ac3 100644 --- a/tests/Top2000.Features.Specs/Features/Search.feature.cs +++ b/tests/Top2000.Features.Specs/Features/Search.feature.cs @@ -23,12 +23,14 @@ namespace Top2000.Features.Specs.Features public partial class SearchFeature { - private static global::Reqnroll.ITestRunner testRunner; + private global::Reqnroll.ITestRunner testRunner; private Microsoft.VisualStudio.TestTools.UnitTesting.TestContext _testContext; private static string[] featureTags = ((string[])(null)); + private static global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Features", "Search", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags); + #line 1 "Search.feature" #line hidden @@ -47,26 +49,25 @@ public virtual Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestCont [Microsoft.VisualStudio.TestTools.UnitTesting.ClassInitializeAttribute()] public static async System.Threading.Tasks.Task FeatureSetupAsync(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext) { - testRunner = global::Reqnroll.TestRunnerManager.GetTestRunnerForAssembly(); - global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Features", "Search", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags); - await testRunner.OnFeatureStartAsync(featureInfo); } [Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute(Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfClass)] public static async System.Threading.Tasks.Task FeatureTearDownAsync() { - await testRunner.OnFeatureEndAsync(); - global::Reqnroll.TestRunnerManager.ReleaseTestRunner(testRunner); - testRunner = null; } [Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute()] public async System.Threading.Tasks.Task TestInitializeAsync() { + testRunner = global::Reqnroll.TestRunnerManager.GetTestRunnerForAssembly(featureHint: featureInfo); if (((testRunner.FeatureContext != null) - && (testRunner.FeatureContext.FeatureInfo.Title != "Search"))) + && (testRunner.FeatureContext.FeatureInfo.Equals(featureInfo) == false))) { - await global::Top2000.Features.Specs.Features.SearchFeature.FeatureSetupAsync(null); + await testRunner.OnFeatureEndAsync(); + } + if ((testRunner.FeatureContext == null)) + { + await testRunner.OnFeatureStartAsync(featureInfo); } } @@ -74,6 +75,7 @@ public async System.Threading.Tasks.Task TestInitializeAsync() public async System.Threading.Tasks.Task TestTearDownAsync() { await testRunner.OnScenarioEndAsync(); + global::Reqnroll.TestRunnerManager.ReleaseTestRunner(testRunner); } public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo) diff --git a/tests/Top2000.Features.Specs/Features/Top2000Data.feature.cs b/tests/Top2000.Features.Specs/Features/Top2000Data.feature.cs index 2e3a7fc..83b4623 100644 --- a/tests/Top2000.Features.Specs/Features/Top2000Data.feature.cs +++ b/tests/Top2000.Features.Specs/Features/Top2000Data.feature.cs @@ -23,12 +23,14 @@ namespace Top2000.Features.Specs.Features public partial class Top2000DataFeature { - private static global::Reqnroll.ITestRunner testRunner; + private global::Reqnroll.ITestRunner testRunner; private Microsoft.VisualStudio.TestTools.UnitTesting.TestContext _testContext; private static string[] featureTags = ((string[])(null)); + private static global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Features", "Top2000Data", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags); + #line 1 "Top2000Data.feature" #line hidden @@ -47,26 +49,25 @@ public virtual Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestCont [Microsoft.VisualStudio.TestTools.UnitTesting.ClassInitializeAttribute()] public static async System.Threading.Tasks.Task FeatureSetupAsync(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext) { - testRunner = global::Reqnroll.TestRunnerManager.GetTestRunnerForAssembly(); - global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Features", "Top2000Data", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags); - await testRunner.OnFeatureStartAsync(featureInfo); } [Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute(Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfClass)] public static async System.Threading.Tasks.Task FeatureTearDownAsync() { - await testRunner.OnFeatureEndAsync(); - global::Reqnroll.TestRunnerManager.ReleaseTestRunner(testRunner); - testRunner = null; } [Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute()] public async System.Threading.Tasks.Task TestInitializeAsync() { + testRunner = global::Reqnroll.TestRunnerManager.GetTestRunnerForAssembly(featureHint: featureInfo); if (((testRunner.FeatureContext != null) - && (testRunner.FeatureContext.FeatureInfo.Title != "Top2000Data"))) + && (testRunner.FeatureContext.FeatureInfo.Equals(featureInfo) == false))) { - await global::Top2000.Features.Specs.Features.Top2000DataFeature.FeatureSetupAsync(null); + await testRunner.OnFeatureEndAsync(); + } + if ((testRunner.FeatureContext == null)) + { + await testRunner.OnFeatureStartAsync(featureInfo); } } @@ -74,6 +75,7 @@ public async System.Threading.Tasks.Task TestInitializeAsync() public async System.Threading.Tasks.Task TestTearDownAsync() { await testRunner.OnScenarioEndAsync(); + global::Reqnroll.TestRunnerManager.ReleaseTestRunner(testRunner); } public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo) @@ -99,15 +101,15 @@ public virtual async System.Threading.Tasks.Task FeatureBackgroundAsync() } [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("All editions, except for the last, contains 2000 positions starting with 1 and en" + - "ding with 2000")] + [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(("All editions, except for the last, contains 2000 positions starting with 1 and en" + + "ding with 2000"))] [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Top2000Data")] public async System.Threading.Tasks.Task AllEditionsExceptForTheLastContains2000PositionsStartingWith1AndEndingWith2000() { string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("All editions, except for the last, contains 2000 positions starting with 1 and en" + - "ding with 2000", null, tagsOfScenario, argumentsOfScenario, featureTags); + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo(("All editions, except for the last, contains 2000 positions starting with 1 and en" + + "ding with 2000"), null, tagsOfScenario, argumentsOfScenario, featureTags); #line 7 this.ScenarioInitialize(scenarioInfo); #line hidden @@ -125,8 +127,8 @@ public async System.Threading.Tasks.Task AllEditionsExceptForTheLastContains2000 await testRunner.GivenAsync("the client database is created", ((string)(null)), ((global::Reqnroll.Table)(null)), "Given "); #line hidden #line 9 -await testRunner.ThenAsync("except for the last edition, the listing table contains 2000 tracks for each edit" + - "ion ranging from 1 to 2000", ((string)(null)), ((global::Reqnroll.Table)(null)), "Then "); +await testRunner.ThenAsync(("except for the last edition, the listing table contains 2000 tracks for each edit" + + "ion ranging from 1 to 2000"), ((string)(null)), ((global::Reqnroll.Table)(null)), "Then "); #line hidden } await this.ScenarioCleanupAsync(); @@ -167,15 +169,15 @@ public async System.Threading.Tasks.Task TheLastEditionCanEitherHave10Or2000Trac } [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("The playtime of each track is either the same to the last track or increment by o" + - "ne hour")] + [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(("The playtime of each track is either the same to the last track or increment by o" + + "ne hour"))] [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Top2000Data")] public async System.Threading.Tasks.Task ThePlaytimeOfEachTrackIsEitherTheSameToTheLastTrackOrIncrementByOneHour() { string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("The playtime of each track is either the same to the last track or increment by o" + - "ne hour", null, tagsOfScenario, argumentsOfScenario, featureTags); + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo(("The playtime of each track is either the same to the last track or increment by o" + + "ne hour"), null, tagsOfScenario, argumentsOfScenario, featureTags); #line 16 this.ScenarioInitialize(scenarioInfo); #line hidden @@ -193,8 +195,8 @@ public async System.Threading.Tasks.Task ThePlaytimeOfEachTrackIsEitherTheSameTo await testRunner.GivenAsync("the client database is created", ((string)(null)), ((global::Reqnroll.Table)(null)), "Given "); #line hidden #line 18 -await testRunner.ThenAsync("for each track in the listing table the PlayDateAndTime is the same to the previo" + - "us track or has incremented by one hour", ((string)(null)), ((global::Reqnroll.Table)(null)), "Then "); +await testRunner.ThenAsync(("for each track in the listing table the PlayDateAndTime is the same to the previo" + + "us track or has incremented by one hour"), ((string)(null)), ((global::Reqnroll.Table)(null)), "Then "); #line hidden } await this.ScenarioCleanupAsync(); diff --git a/tests/Top2000.Features.Specs/Features/TrackInformation.feature.cs b/tests/Top2000.Features.Specs/Features/TrackInformation.feature.cs index 07b3827..618dbed 100644 --- a/tests/Top2000.Features.Specs/Features/TrackInformation.feature.cs +++ b/tests/Top2000.Features.Specs/Features/TrackInformation.feature.cs @@ -23,12 +23,14 @@ namespace Top2000.Features.Specs.Features public partial class TrackInformationFeature { - private static global::Reqnroll.ITestRunner testRunner; + private global::Reqnroll.ITestRunner testRunner; private Microsoft.VisualStudio.TestTools.UnitTesting.TestContext _testContext; private static string[] featureTags = ((string[])(null)); + private static global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Features", "TrackInformation", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags); + #line 1 "TrackInformation.feature" #line hidden @@ -47,26 +49,25 @@ public virtual Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestCont [Microsoft.VisualStudio.TestTools.UnitTesting.ClassInitializeAttribute()] public static async System.Threading.Tasks.Task FeatureSetupAsync(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext) { - testRunner = global::Reqnroll.TestRunnerManager.GetTestRunnerForAssembly(); - global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Features", "TrackInformation", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags); - await testRunner.OnFeatureStartAsync(featureInfo); } [Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute(Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfClass)] public static async System.Threading.Tasks.Task FeatureTearDownAsync() { - await testRunner.OnFeatureEndAsync(); - global::Reqnroll.TestRunnerManager.ReleaseTestRunner(testRunner); - testRunner = null; } [Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute()] public async System.Threading.Tasks.Task TestInitializeAsync() { + testRunner = global::Reqnroll.TestRunnerManager.GetTestRunnerForAssembly(featureHint: featureInfo); if (((testRunner.FeatureContext != null) - && (testRunner.FeatureContext.FeatureInfo.Title != "TrackInformation"))) + && (testRunner.FeatureContext.FeatureInfo.Equals(featureInfo) == false))) { - await global::Top2000.Features.Specs.Features.TrackInformationFeature.FeatureSetupAsync(null); + await testRunner.OnFeatureEndAsync(); + } + if ((testRunner.FeatureContext == null)) + { + await testRunner.OnFeatureStartAsync(featureInfo); } } @@ -74,6 +75,7 @@ public async System.Threading.Tasks.Task TestInitializeAsync() public async System.Threading.Tasks.Task TestTearDownAsync() { await testRunner.OnScenarioEndAsync(); + global::Reqnroll.TestRunnerManager.ReleaseTestRunner(testRunner); } public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo) @@ -268,15 +270,15 @@ public async System.Threading.Tasks.Task TheFirstTimeATrackIsListedTheStatusOfTh } [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Tracks that are listed again but was not in the previous edition the status is li" + - "sted as Back")] + [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(("Tracks that are listed again but was not in the previous edition the status is li" + + "sted as Back"))] [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "TrackInformation")] public async System.Threading.Tasks.Task TracksThatAreListedAgainButWasNotInThePreviousEditionTheStatusIsListedAsBack() { string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Tracks that are listed again but was not in the previous edition the status is li" + - "sted as Back", null, tagsOfScenario, argumentsOfScenario, featureTags); + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo(("Tracks that are listed again but was not in the previous edition the status is li" + + "sted as Back"), null, tagsOfScenario, argumentsOfScenario, featureTags); #line 40 this.ScenarioInitialize(scenarioInfo); #line hidden @@ -307,15 +309,15 @@ public async System.Threading.Tasks.Task TracksThatAreListedAgainButWasNotInTheP } [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Tracks that are higher on the list than previous edition are listed are Increased" + - " and a offset is indicating the delta")] + [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(("Tracks that are higher on the list than previous edition are listed are Increased" + + " and a offset is indicating the delta"))] [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "TrackInformation")] public async System.Threading.Tasks.Task TracksThatAreHigherOnTheListThanPreviousEditionAreListedAreIncreasedAndAOffsetIsIndicatingTheDelta() { string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Tracks that are higher on the list than previous edition are listed are Increased" + - " and a offset is indicating the delta", null, tagsOfScenario, argumentsOfScenario, featureTags); + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo(("Tracks that are higher on the list than previous edition are listed are Increased" + + " and a offset is indicating the delta"), null, tagsOfScenario, argumentsOfScenario, featureTags); #line 46 this.ScenarioInitialize(scenarioInfo); #line hidden @@ -367,15 +369,15 @@ public async System.Threading.Tasks.Task TracksThatAreHigherOnTheListThanPreviou } [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Tracks that are lower on the list than previous edition are listed are Decreased " + - "and a offset is indicating the delta")] + [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(("Tracks that are lower on the list than previous edition are listed are Decreased " + + "and a offset is indicating the delta"))] [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "TrackInformation")] public async System.Threading.Tasks.Task TracksThatAreLowerOnTheListThanPreviousEditionAreListedAreDecreasedAndAOffsetIsIndicatingTheDelta() { string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Tracks that are lower on the list than previous edition are listed are Decreased " + - "and a offset is indicating the delta", null, tagsOfScenario, argumentsOfScenario, featureTags); + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo(("Tracks that are lower on the list than previous edition are listed are Decreased " + + "and a offset is indicating the delta"), null, tagsOfScenario, argumentsOfScenario, featureTags); #line 59 this.ScenarioInitialize(scenarioInfo); #line hidden @@ -457,15 +459,15 @@ public async System.Threading.Tasks.Task TracksThatAreLowerOnTheListThanPrevious } [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Tracks that haven\'t change position since the previous edition are listed as Unch" + - "anged")] + [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(("Tracks that haven\'t change position since the previous edition are listed as Unch" + + "anged"))] [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "TrackInformation")] public async System.Threading.Tasks.Task TracksThatHaventChangePositionSinceThePreviousEditionAreListedAsUnchanged() { string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Tracks that haven\'t change position since the previous edition are listed as Unch" + - "anged", null, tagsOfScenario, argumentsOfScenario, featureTags); + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo(("Tracks that haven\'t change position since the previous edition are listed as Unch" + + "anged"), null, tagsOfScenario, argumentsOfScenario, featureTags); #line 82 this.ScenarioInitialize(scenarioInfo); #line hidden @@ -486,8 +488,8 @@ public async System.Threading.Tasks.Task TracksThatHaventChangePositionSinceTheP await testRunner.WhenAsync("the track information feature is executed for TrackId 2218", ((string)(null)), ((global::Reqnroll.Table)(null)), "When "); #line hidden #line 85 -await testRunner.ThenAsync("the title is \"Nothing Else Matters\" from \'Metallica\' which is recorded in the yea" + - "r 1992", ((string)(null)), ((global::Reqnroll.Table)(null)), "Then "); +await testRunner.ThenAsync(("the title is \"Nothing Else Matters\" from \'Metallica\' which is recorded in the yea" + + "r 1992"), ((string)(null)), ((global::Reqnroll.Table)(null)), "Then "); #line hidden global::Reqnroll.Table table14 = new global::Reqnroll.Table(new string[] { "Edition", @@ -506,15 +508,15 @@ await testRunner.ThenAsync("the title is \"Nothing Else Matters\" from \'Metalli } [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("\'Since release\' is the statistic that shows how many times the tracks could have " + - "been listed")] + [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(("\'Since release\' is the statistic that shows how many times the tracks could have " + + "been listed"))] [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "TrackInformation")] public async System.Threading.Tasks.Task SinceReleaseIsTheStatisticThatShowsHowManyTimesTheTracksCouldHaveBeenListed() { string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("\'Since release\' is the statistic that shows how many times the tracks could have " + - "been listed", null, tagsOfScenario, argumentsOfScenario, featureTags); + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo(("\'Since release\' is the statistic that shows how many times the tracks could have " + + "been listed"), null, tagsOfScenario, argumentsOfScenario, featureTags); #line 91 this.ScenarioInitialize(scenarioInfo); #line hidden @@ -659,15 +661,13 @@ public async System.Threading.Tasks.Task LastPostionShowsThePositionOfLatestEdit } [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("First position shows the position of the first edition where the track was listed" + - "")] + [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("First position shows the position of the first edition where the track was listed")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "TrackInformation")] public async System.Threading.Tasks.Task FirstPositionShowsThePositionOfTheFirstEditionWhereTheTrackWasListed() { string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("First position shows the position of the first edition where the track was listed" + - "", null, tagsOfScenario, argumentsOfScenario, featureTags); + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("First position shows the position of the first edition where the track was listed", null, tagsOfScenario, argumentsOfScenario, featureTags); #line 116 this.ScenarioInitialize(scenarioInfo); #line hidden diff --git a/tests/Top2000.Features.Specs/Top2000.Features.Specs.csproj b/tests/Top2000.Features.Specs/Top2000.Features.Specs.csproj index f9878aa..20dd02e 100644 --- a/tests/Top2000.Features.Specs/Top2000.Features.Specs.csproj +++ b/tests/Top2000.Features.Specs/Top2000.Features.Specs.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 enable disable @@ -23,13 +23,13 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - + + + + + + + diff --git a/tests/Top2000.Features.Tests/Top2000.Features.Tests.csproj b/tests/Top2000.Features.Tests/Top2000.Features.Tests.csproj index a638bc6..79110e0 100644 --- a/tests/Top2000.Features.Tests/Top2000.Features.Tests.csproj +++ b/tests/Top2000.Features.Tests/Top2000.Features.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable @@ -14,11 +14,11 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - - + + From c0e33ad62456d60cd563b8409dda294670f4d5f3 Mon Sep 17 00:00:00 2001 From: Rick Neeft Date: Sun, 1 Dec 2024 15:02:21 +0100 Subject: [PATCH 3/7] Update service creation --- src/SQLite/Top2000.Features.SQLite/ConfigureServices.cs | 7 ++++--- tests/Top2000.Features.Specs/App.cs | 6 ++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/SQLite/Top2000.Features.SQLite/ConfigureServices.cs b/src/SQLite/Top2000.Features.SQLite/ConfigureServices.cs index 2f9b8e8..8e060e4 100644 --- a/src/SQLite/Top2000.Features.SQLite/ConfigureServices.cs +++ b/src/SQLite/Top2000.Features.SQLite/ConfigureServices.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.DependencyInjection; +using Top2000.Data.ClientDatabase; using Top2000.Features.Searching; using Top2000.Features.SQLite.AllListingsOfEdition; @@ -6,9 +7,10 @@ namespace Top2000.Features.SQLite; public static class ConfigureServices { - public static IServiceCollection AddFeaturesWithSQLite(this IServiceCollection services) + public static IServiceCollection AddTop2000Features(this IServiceCollection services, Action? configure = null) { return services + .AddTop2000(configure) .AddMediatR(config => { config.RegisterServicesFromAssemblyContaining(); @@ -19,7 +21,6 @@ public static IServiceCollection AddFeaturesWithSQLite(this IServiceCollection s .AddSingleton() .AddSingleton() .AddSingleton() - .AddSingleton() - ; + .AddSingleton(); } } diff --git a/tests/Top2000.Features.Specs/App.cs b/tests/Top2000.Features.Specs/App.cs index 0e7ad45..96a2ddf 100644 --- a/tests/Top2000.Features.Specs/App.cs +++ b/tests/Top2000.Features.Specs/App.cs @@ -19,15 +19,13 @@ public static class App public static void BeforeTestRun() { var services = new ServiceCollection() - .AddTop2000(builder => + .AddTop2000Features(builder => { builder .DatabaseDirectory(Directory.GetCurrentDirectory()) .DatabaseName("top2000_unittest.db") .EnableOnlineUpdates(); - }) - .AddFeaturesWithSQLite() - ; + }); ServiceProvider = services.BuildServiceProvider(); } From 61f125f67bf39e4a8c666547e6ad68e22693f39f Mon Sep 17 00:00:00 2001 From: Rick Neeft Date: Sun, 1 Dec 2024 15:17:58 +0100 Subject: [PATCH 4/7] Updated search handler --- .../Searching/SearchTrackRequestHandler.cs | 10 +- .../Top2000.Features.SQLite.csproj | 2 +- .../Features/Search.feature | 11 ++ .../Features/Search.feature.cs | 125 +++++++++++++----- .../Features/TrackInformation.feature.cs | 88 ++++++------ 5 files changed, 152 insertions(+), 84 deletions(-) diff --git a/src/SQLite/Top2000.Features.SQLite/Searching/SearchTrackRequestHandler.cs b/src/SQLite/Top2000.Features.SQLite/Searching/SearchTrackRequestHandler.cs index 187ab4a..18327be 100644 --- a/src/SQLite/Top2000.Features.SQLite/Searching/SearchTrackRequestHandler.cs +++ b/src/SQLite/Top2000.Features.SQLite/Searching/SearchTrackRequestHandler.cs @@ -23,21 +23,21 @@ public async Task>> Handle(SearchTrackRequ { var sql = "SELECT Id, Title, Artist, RecordedYear, Listing.Position AS Position " + "FROM Track " + - "LEFT JOIN Listing ON Track.Id = Listing.TrackId AND Listing.Edition = 2023 " + + "LEFT JOIN Listing ON Track.Id = Listing.TrackId AND Listing.Edition = ? " + "WHERE RecordedYear = ?" + "LIMIT 100"; - results = await connection.QueryAsync(sql, year); + results = await connection.QueryAsync(sql, request.LatestYear, year); } else { var sql = "SELECT Id, Title, Artist, RecordedYear, Listing.Position AS Position " + "FROM Track " + - "LEFT JOIN Listing ON Track.Id = Listing.TrackId AND Listing.Edition = 2023 " + - "WHERE (Title LIKE ?) OR (Artist LIKE ?)" + + "LEFT JOIN Listing ON Track.Id = Listing.TrackId AND Listing.Edition = ? " + + "WHERE (Title LIKE ?) OR (Artist LIKE ?) OR (SearchTitle LIKE ?) OR (SearchArtist LIKE ?)" + "LIMIT 100"; - results = await connection.QueryAsync(sql, $"%{request.QueryString}%", $"%{request.QueryString}%"); + results = await connection.QueryAsync(sql,request.LatestYear, $"%{request.QueryString}%", $"%{request.QueryString}%", $"%{request.QueryString}%", $"%{request.QueryString}%"); } } diff --git a/src/SQLite/Top2000.Features.SQLite/Top2000.Features.SQLite.csproj b/src/SQLite/Top2000.Features.SQLite/Top2000.Features.SQLite.csproj index 793908b..a67b03a 100644 --- a/src/SQLite/Top2000.Features.SQLite/Top2000.Features.SQLite.csproj +++ b/src/SQLite/Top2000.Features.SQLite/Top2000.Features.SQLite.csproj @@ -11,7 +11,7 @@ Top 2000 Features package using the SQLite package Copyright (c) Rick Neeft Development 2024 https://github.com/Top2000app/data - 1.1.1 + 2.0.0 Rick Neeft Top2000App nugeticon.png diff --git a/tests/Top2000.Features.Specs/Features/Search.feature b/tests/Top2000.Features.Specs/Features/Search.feature index 65c186a..8635c55 100644 --- a/tests/Top2000.Features.Specs/Features/Search.feature +++ b/tests/Top2000.Features.Specs/Features/Search.feature @@ -1,5 +1,16 @@ Feature: Search +Scenario: Tracks can be searched by the counter part of a special character +Given All data scripts +When searching for S10 & BLOF +Then the following tracks are found: +| Id | Title | Artist | Recorded Year | +| 4902 | Laat Me Los | S10 & BLØF | 2022 | +When searching for /\ +Then the following tracks are found: +| Id | Title | Artist | Recorded Year | +| 4056 | Sun Is shining | Axwell Λ Ingrosso | 2015 | + Scenario: Track can be searching by title Given All data scripts When searching for Piano diff --git a/tests/Top2000.Features.Specs/Features/Search.feature.cs b/tests/Top2000.Features.Specs/Features/Search.feature.cs index 1d97ac3..1576098 100644 --- a/tests/Top2000.Features.Specs/Features/Search.feature.cs +++ b/tests/Top2000.Features.Specs/Features/Search.feature.cs @@ -95,13 +95,13 @@ public async System.Threading.Tasks.Task ScenarioCleanupAsync() } [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Track can be searching by title")] + [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Tracks can be searched by the counter part of a special character")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Search")] - public async System.Threading.Tasks.Task TrackCanBeSearchingByTitle() + public async System.Threading.Tasks.Task TracksCanBeSearchedByTheCounterPartOfASpecialCharacter() { string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Track can be searching by title", null, tagsOfScenario, argumentsOfScenario, featureTags); + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Tracks can be searched by the counter part of a special character", null, tagsOfScenario, argumentsOfScenario, featureTags); #line 3 this.ScenarioInitialize(scenarioInfo); #line hidden @@ -116,7 +116,7 @@ public async System.Threading.Tasks.Task TrackCanBeSearchingByTitle() await testRunner.GivenAsync("All data scripts", ((string)(null)), ((global::Reqnroll.Table)(null)), "Given "); #line hidden #line 5 -await testRunner.WhenAsync("searching for Piano", ((string)(null)), ((global::Reqnroll.Table)(null)), "When "); +await testRunner.WhenAsync("searching for S10 & BLOF", ((string)(null)), ((global::Reqnroll.Table)(null)), "When "); #line hidden global::Reqnroll.Table table7 = new global::Reqnroll.Table(new string[] { "Id", @@ -124,22 +124,79 @@ public async System.Threading.Tasks.Task TrackCanBeSearchingByTitle() "Artist", "Recorded Year"}); table7.AddRow(new string[] { + "4902", + "Laat Me Los", + "S10 & BLØF", + "2022"}); +#line 6 +await testRunner.ThenAsync("the following tracks are found:", ((string)(null)), table7, "Then "); +#line hidden +#line 9 +await testRunner.WhenAsync("searching for /\\", ((string)(null)), ((global::Reqnroll.Table)(null)), "When "); +#line hidden + global::Reqnroll.Table table8 = new global::Reqnroll.Table(new string[] { + "Id", + "Title", + "Artist", + "Recorded Year"}); + table8.AddRow(new string[] { + "4056", + "Sun Is shining", + "Axwell Λ Ingrosso", + "2015"}); +#line 10 +await testRunner.ThenAsync("the following tracks are found:", ((string)(null)), table8, "Then "); +#line hidden + } + await this.ScenarioCleanupAsync(); + } + + [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] + [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Track can be searching by title")] + [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Search")] + public async System.Threading.Tasks.Task TrackCanBeSearchingByTitle() + { + string[] tagsOfScenario = ((string[])(null)); + System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Track can be searching by title", null, tagsOfScenario, argumentsOfScenario, featureTags); +#line 14 +this.ScenarioInitialize(scenarioInfo); +#line hidden + if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) + { + testRunner.SkipScenario(); + } + else + { + await this.ScenarioStartAsync(); +#line 15 +await testRunner.GivenAsync("All data scripts", ((string)(null)), ((global::Reqnroll.Table)(null)), "Given "); +#line hidden +#line 16 +await testRunner.WhenAsync("searching for Piano", ((string)(null)), ((global::Reqnroll.Table)(null)), "When "); +#line hidden + global::Reqnroll.Table table9 = new global::Reqnroll.Table(new string[] { + "Id", + "Title", + "Artist", + "Recorded Year"}); + table9.AddRow(new string[] { "2134", "My old piano", "Diana Ross", "1980"}); - table7.AddRow(new string[] { + table9.AddRow(new string[] { "2358", "Piano Man", "Billy Joel", "1974"}); - table7.AddRow(new string[] { + table9.AddRow(new string[] { "3558", "Worn Down Piano", "Mark & Clark Band", "1977"}); -#line 6 -await testRunner.ThenAsync("the following tracks are found:", ((string)(null)), table7, "Then "); +#line 17 +await testRunner.ThenAsync("the following tracks are found:", ((string)(null)), table9, "Then "); #line hidden } await this.ScenarioCleanupAsync(); @@ -153,7 +210,7 @@ public async System.Threading.Tasks.Task TracksCanBeSearchingByArtist() string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Tracks can be searching by artist", null, tagsOfScenario, argumentsOfScenario, featureTags); -#line 12 +#line 23 this.ScenarioInitialize(scenarioInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) @@ -163,24 +220,24 @@ public async System.Threading.Tasks.Task TracksCanBeSearchingByArtist() else { await this.ScenarioStartAsync(); -#line 13 +#line 24 await testRunner.GivenAsync("All data scripts", ((string)(null)), ((global::Reqnroll.Table)(null)), "Given "); #line hidden -#line 14 +#line 25 await testRunner.WhenAsync("searching for Soleil", ((string)(null)), ((global::Reqnroll.Table)(null)), "When "); #line hidden - global::Reqnroll.Table table8 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table10 = new global::Reqnroll.Table(new string[] { "Id", "Title", "Artist", "Recorded Year"}); - table8.AddRow(new string[] { + table10.AddRow(new string[] { "119", "Alegria", "Cirque du Soleil", "1997"}); -#line 15 -await testRunner.ThenAsync("the following tracks are found:", ((string)(null)), table8, "Then "); +#line 26 +await testRunner.ThenAsync("the following tracks are found:", ((string)(null)), table10, "Then "); #line hidden } await this.ScenarioCleanupAsync(); @@ -194,7 +251,7 @@ public async System.Threading.Tasks.Task TrackCanBeSearchedByTheirFullRecordedYe string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Track can be searched by their full RecordedYear", null, tagsOfScenario, argumentsOfScenario, featureTags); -#line 19 +#line 30 this.ScenarioInitialize(scenarioInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) @@ -204,24 +261,24 @@ public async System.Threading.Tasks.Task TrackCanBeSearchedByTheirFullRecordedYe else { await this.ScenarioStartAsync(); -#line 20 +#line 31 await testRunner.GivenAsync("All data scripts", ((string)(null)), ((global::Reqnroll.Table)(null)), "Given "); #line hidden -#line 21 +#line 32 await testRunner.WhenAsync("searching for 1954", ((string)(null)), ((global::Reqnroll.Table)(null)), "When "); #line hidden - global::Reqnroll.Table table9 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table11 = new global::Reqnroll.Table(new string[] { "Id", "Title", "Artist", "Recorded Year"}); - table9.AddRow(new string[] { + table11.AddRow(new string[] { "3468", "White Christmas", "Bing Crosby", "1954"}); -#line 22 -await testRunner.ThenAsync("the following tracks are found:", ((string)(null)), table9, "Then "); +#line 33 +await testRunner.ThenAsync("the following tracks are found:", ((string)(null)), table11, "Then "); #line hidden } await this.ScenarioCleanupAsync(); @@ -235,7 +292,7 @@ public async System.Threading.Tasks.Task SearchingTrackByTheirRecordedYearAreOnl string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Searching track by their RecordedYear are only found by searching the full year", null, tagsOfScenario, argumentsOfScenario, featureTags); -#line 26 +#line 37 this.ScenarioInitialize(scenarioInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) @@ -245,13 +302,13 @@ public async System.Threading.Tasks.Task SearchingTrackByTheirRecordedYearAreOnl else { await this.ScenarioStartAsync(); -#line 27 +#line 38 await testRunner.GivenAsync("All data scripts", ((string)(null)), ((global::Reqnroll.Table)(null)), "Given "); #line hidden -#line 28 +#line 39 await testRunner.WhenAsync("searching for 54", ((string)(null)), ((global::Reqnroll.Table)(null)), "When "); #line hidden -#line 29 +#line 40 await testRunner.ThenAsync("the track White Christmas is not found", ((string)(null)), ((global::Reqnroll.Table)(null)), "Then "); #line hidden } @@ -266,7 +323,7 @@ public async System.Threading.Tasks.Task SearchingWillHaveAResultCapOf100() string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Searching will have a result cap of 100", null, tagsOfScenario, argumentsOfScenario, featureTags); -#line 31 +#line 42 this.ScenarioInitialize(scenarioInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) @@ -276,13 +333,13 @@ public async System.Threading.Tasks.Task SearchingWillHaveAResultCapOf100() else { await this.ScenarioStartAsync(); -#line 32 +#line 43 await testRunner.GivenAsync("All data scripts", ((string)(null)), ((global::Reqnroll.Table)(null)), "Given "); #line hidden -#line 33 +#line 44 await testRunner.WhenAsync("searching for a", ((string)(null)), ((global::Reqnroll.Table)(null)), "When "); #line hidden -#line 34 +#line 45 await testRunner.ThenAsync("the results contain 100 items", ((string)(null)), ((global::Reqnroll.Table)(null)), "Then "); #line hidden } @@ -297,7 +354,7 @@ public async System.Threading.Tasks.Task AnEmptySearchQuertyGiveZeroResults() string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("An empty search querty give zero results", null, tagsOfScenario, argumentsOfScenario, featureTags); -#line 36 +#line 47 this.ScenarioInitialize(scenarioInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) @@ -307,13 +364,13 @@ public async System.Threading.Tasks.Task AnEmptySearchQuertyGiveZeroResults() else { await this.ScenarioStartAsync(); -#line 37 +#line 48 await testRunner.GivenAsync("All data scripts", ((string)(null)), ((global::Reqnroll.Table)(null)), "Given "); #line hidden -#line 38 +#line 49 await testRunner.WhenAsync("searching without a query", ((string)(null)), ((global::Reqnroll.Table)(null)), "When "); #line hidden -#line 39 +#line 50 await testRunner.ThenAsync("the results contain 0 items", ((string)(null)), ((global::Reqnroll.Table)(null)), "Then "); #line hidden } diff --git a/tests/Top2000.Features.Specs/Features/TrackInformation.feature.cs b/tests/Top2000.Features.Specs/Features/TrackInformation.feature.cs index 618dbed..0bfa00c 100644 --- a/tests/Top2000.Features.Specs/Features/TrackInformation.feature.cs +++ b/tests/Top2000.Features.Specs/Features/TrackInformation.feature.cs @@ -164,18 +164,18 @@ public async System.Threading.Tasks.Task TracksThatAreRecordedAfterTheFirstEditi #line 13 await testRunner.ThenAsync("the title is \"Hurt\" from \'Johnny Cash\' which is recorded in the year 2003", ((string)(null)), ((global::Reqnroll.Table)(null)), "Then "); #line hidden - global::Reqnroll.Table table10 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table12 = new global::Reqnroll.Table(new string[] { "Edition"}); - table10.AddRow(new string[] { + table12.AddRow(new string[] { "2002"}); - table10.AddRow(new string[] { + table12.AddRow(new string[] { "2001"}); - table10.AddRow(new string[] { + table12.AddRow(new string[] { "2000"}); - table10.AddRow(new string[] { + table12.AddRow(new string[] { "1999"}); #line 14 -await testRunner.AndAsync("the following years are listed as \'NotAvailable\'", ((string)(null)), table10, "And "); +await testRunner.AndAsync("the following years are listed as \'NotAvailable\'", ((string)(null)), table12, "And "); #line hidden } await this.ScenarioCleanupAsync(); @@ -211,22 +211,22 @@ public async System.Threading.Tasks.Task TrackThatWereRecordedButDidNotMadeItOnT #line 24 await testRunner.ThenAsync("the title is \"Hurt\" from \'Johnny Cash\' which is recorded in the year 2003", ((string)(null)), ((global::Reqnroll.Table)(null)), "Then "); #line hidden - global::Reqnroll.Table table11 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table13 = new global::Reqnroll.Table(new string[] { "Edition"}); - table11.AddRow(new string[] { + table13.AddRow(new string[] { "2003"}); - table11.AddRow(new string[] { + table13.AddRow(new string[] { "2004"}); - table11.AddRow(new string[] { + table13.AddRow(new string[] { "2005"}); - table11.AddRow(new string[] { + table13.AddRow(new string[] { "2006"}); - table11.AddRow(new string[] { + table13.AddRow(new string[] { "2007"}); - table11.AddRow(new string[] { + table13.AddRow(new string[] { "2008"}); #line 25 -await testRunner.AndAsync("the following years are listed as \'NotListed\'", ((string)(null)), table11, "And "); +await testRunner.AndAsync("the following years are listed as \'NotListed\'", ((string)(null)), table13, "And "); #line hidden } await this.ScenarioCleanupAsync(); @@ -340,29 +340,29 @@ public async System.Threading.Tasks.Task TracksThatAreHigherOnTheListThanPreviou #line 49 await testRunner.ThenAsync("the title is \"Killer Queen\" from \'Queen\' which is recorded in the year 1974", ((string)(null)), ((global::Reqnroll.Table)(null)), "Then "); #line hidden - global::Reqnroll.Table table12 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table14 = new global::Reqnroll.Table(new string[] { "Edition", "Offset"}); - table12.AddRow(new string[] { + table14.AddRow(new string[] { "2000", "33"}); - table12.AddRow(new string[] { + table14.AddRow(new string[] { "2002", "19"}); - table12.AddRow(new string[] { + table14.AddRow(new string[] { "2008", "262"}); - table12.AddRow(new string[] { + table14.AddRow(new string[] { "2011", "85"}); - table12.AddRow(new string[] { + table14.AddRow(new string[] { "2017", "9"}); - table12.AddRow(new string[] { + table14.AddRow(new string[] { "2018", "222"}); #line 50 -await testRunner.AndAsync("the following years are listed as \'Increased\'", ((string)(null)), table12, "And "); +await testRunner.AndAsync("the following years are listed as \'Increased\'", ((string)(null)), table14, "And "); #line hidden } await this.ScenarioCleanupAsync(); @@ -400,59 +400,59 @@ public async System.Threading.Tasks.Task TracksThatAreLowerOnTheListThanPrevious #line 62 await testRunner.ThenAsync("the title is \"Killer Queen\" from \'Queen\' which is recorded in the year 1974", ((string)(null)), ((global::Reqnroll.Table)(null)), "Then "); #line hidden - global::Reqnroll.Table table13 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table15 = new global::Reqnroll.Table(new string[] { "Edition", "Offset"}); - table13.AddRow(new string[] { + table15.AddRow(new string[] { "2001", "27"}); - table13.AddRow(new string[] { + table15.AddRow(new string[] { "2003", "1"}); - table13.AddRow(new string[] { + table15.AddRow(new string[] { "2004", "30"}); - table13.AddRow(new string[] { + table15.AddRow(new string[] { "2005", "45"}); - table13.AddRow(new string[] { + table15.AddRow(new string[] { "2006", "27"}); - table13.AddRow(new string[] { + table15.AddRow(new string[] { "2007", "255"}); - table13.AddRow(new string[] { + table15.AddRow(new string[] { "2009", "7"}); - table13.AddRow(new string[] { + table15.AddRow(new string[] { "2010", "76"}); - table13.AddRow(new string[] { + table15.AddRow(new string[] { "2012", "13"}); - table13.AddRow(new string[] { + table15.AddRow(new string[] { "2013", "27"}); - table13.AddRow(new string[] { + table15.AddRow(new string[] { "2014", "18"}); - table13.AddRow(new string[] { + table15.AddRow(new string[] { "2015", "10"}); - table13.AddRow(new string[] { + table15.AddRow(new string[] { "2016", "3"}); - table13.AddRow(new string[] { + table15.AddRow(new string[] { "2019", "18"}); - table13.AddRow(new string[] { + table15.AddRow(new string[] { "2020", "25"}); - table13.AddRow(new string[] { + table15.AddRow(new string[] { "2020", "38"}); #line 63 -await testRunner.AndAsync("the following years are listed as \'Decreased\'", ((string)(null)), table13, "And "); +await testRunner.AndAsync("the following years are listed as \'Decreased\'", ((string)(null)), table15, "And "); #line hidden } await this.ScenarioCleanupAsync(); @@ -491,17 +491,17 @@ public async System.Threading.Tasks.Task TracksThatHaventChangePositionSinceTheP await testRunner.ThenAsync(("the title is \"Nothing Else Matters\" from \'Metallica\' which is recorded in the yea" + "r 1992"), ((string)(null)), ((global::Reqnroll.Table)(null)), "Then "); #line hidden - global::Reqnroll.Table table14 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table16 = new global::Reqnroll.Table(new string[] { "Edition", "Offset"}); - table14.AddRow(new string[] { + table16.AddRow(new string[] { "2017", "0"}); - table14.AddRow(new string[] { + table16.AddRow(new string[] { "2012", "0"}); #line 86 -await testRunner.AndAsync("the following years are listed as \'Unchanged\'", ((string)(null)), table14, "And "); +await testRunner.AndAsync("the following years are listed as \'Unchanged\'", ((string)(null)), table16, "And "); #line hidden } await this.ScenarioCleanupAsync(); From c81abea929f89086d17016b5137bee9073ad054f Mon Sep 17 00:00:00 2001 From: Rick Neeft Date: Sun, 1 Dec 2024 15:23:13 +0100 Subject: [PATCH 5/7] Updated analyse --- .github/workflows/analyse.yml | 96 ++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 46 deletions(-) diff --git a/.github/workflows/analyse.yml b/.github/workflows/analyse.yml index f2fdf84..30c0d2d 100644 --- a/.github/workflows/analyse.yml +++ b/.github/workflows/analyse.yml @@ -10,50 +10,54 @@ jobs: name: Build and analyze runs-on: windows-latest steps: - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: 'zulu' # Alternative distribution options are available. - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'zulu' # Alternative distribution options are available. + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.x - - uses: actions/checkout@v3 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - - name: Cache SonarCloud packages - uses: actions/cache@v3 - with: - path: ~\sonar\cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - - name: Cache SonarCloud scanner - id: cache-sonar-scanner - uses: actions/cache@v3 - with: - path: .\.sonar\scanner - key: ${{ runner.os }}-sonar-scanner - restore-keys: ${{ runner.os }}-sonar-scanner - - - name: Install SonarCloud scanner - if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' - shell: powershell - run: | - New-Item -Path .\.sonar\scanner -ItemType Directory - dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner - - - name: Build and analyze - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - shell: powershell - run: | - .\.sonar\scanner\dotnet-sonarscanner begin /k:"Top2000app_features" /o:"top2000app" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" - dotnet build - dotnet test --no-build --verbosity normal - .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + + - name: Cache SonarCloud packages + uses: actions/cache@v3 + with: + path: ~\sonar\cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + + - name: Cache SonarCloud scanner + id: cache-sonar-scanner + uses: actions/cache@v3 + with: + path: .\.sonar\scanner + key: ${{ runner.os }}-sonar-scanner + restore-keys: ${{ runner.os }}-sonar-scanner + + - name: Install SonarCloud scanner + if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' + shell: powershell + run: | + New-Item -Path .\.sonar\scanner -ItemType Directory + dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner + + - name: Install dotnet coverage + shell: powershell + run: dotnet tool install dotnet-coverage --global + + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + shell: powershell + run: | + .\.sonar\scanner\dotnet-sonarscanner begin /k:"Top2000app_features" /o:"top2000app" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml + dotnet build + dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml" + .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" From ec018c77d995079dc9ec4684cde06a9f5c86b275 Mon Sep 17 00:00:00 2001 From: Rick Neeft Date: Sun, 1 Dec 2024 15:26:56 +0100 Subject: [PATCH 6/7] Added a dotnet build --- .github/workflows/dotnet.yml | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/dotnet.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..2ccc116 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,48 @@ +name: .NET + +permissions: + contents: read + pages: write + id-token: write + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.x + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --no-restore + + - name: Test + run: dotnet test --no-build --verbosity normal + + - name: Pack + run: dotnet pack -o '${{github.workspace}}/nupkg' + + - name: Publish App disk artifact + uses: actions/upload-artifact@v3 + with: + name: Code + path: nupkg + if: github.event_name != 'pull_request' + + - name: Publish Nuget + run: dotnet nuget push '${{github.workspace}}/nupkg/*.nupkg' -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate + if: github.event_name != 'pull_request' + \ No newline at end of file From 874166baa6749f189f5c44711aa3058a531043f6 Mon Sep 17 00:00:00 2001 From: Rick Neeft Date: Sun, 1 Dec 2024 21:11:58 +0100 Subject: [PATCH 7/7] Description update --- .../Top2000.Features.SQLite/Top2000.Features.SQLite.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SQLite/Top2000.Features.SQLite/Top2000.Features.SQLite.csproj b/src/SQLite/Top2000.Features.SQLite/Top2000.Features.SQLite.csproj index a67b03a..7208ed1 100644 --- a/src/SQLite/Top2000.Features.SQLite/Top2000.Features.SQLite.csproj +++ b/src/SQLite/Top2000.Features.SQLite/Top2000.Features.SQLite.csproj @@ -8,7 +8,7 @@ true true RickNeeftDevelopment.Top2000App.Features.SQLite - Top 2000 Features package using the SQLite package + Top 2000 Features package using the SQLite database Copyright (c) Rick Neeft Development 2024 https://github.com/Top2000app/data 2.0.0