From aa489ca840662db7dcdf34f32efe16e87cccd246 Mon Sep 17 00:00:00 2001 From: tofages1 Date: Mon, 15 May 2023 10:26:04 +0100 Subject: [PATCH] Test --- ParionsCuite/ParionsCuite/ParionsCuite.csproj | 229 +++++++++--------- .../ParionsCuite/Test/SqlDatabaseSetup.cs | 25 ++ .../Test/TestInitializeAttribute.cs | 6 + ParionsCuite/ParionsCuite/Test/TestManager.cs | 86 +++++++ ParionsCuite/ParionsCuite/Test/app.config | 11 + 5 files changed, 247 insertions(+), 110 deletions(-) create mode 100644 ParionsCuite/ParionsCuite/Test/SqlDatabaseSetup.cs create mode 100644 ParionsCuite/ParionsCuite/Test/TestInitializeAttribute.cs create mode 100644 ParionsCuite/ParionsCuite/Test/TestManager.cs create mode 100644 ParionsCuite/ParionsCuite/Test/app.config diff --git a/ParionsCuite/ParionsCuite/ParionsCuite.csproj b/ParionsCuite/ParionsCuite/ParionsCuite.csproj index 73157ac..fa450c6 100644 --- a/ParionsCuite/ParionsCuite/ParionsCuite.csproj +++ b/ParionsCuite/ParionsCuite/ParionsCuite.csproj @@ -1,111 +1,120 @@  - - - net7.0-android;net7.0-ios;net7.0-maccatalyst - $(TargetFrameworks);net7.0-windows10.0.19041.0 - - - - Exe - ParionsCuite - true - true - enable - - - ParionsCuite - - - com.companyname.parionscuite - be941c7a-90b1-469a-aa20-94c786120159 - - - 1.0 - 1 - - 11.0 - 13.1 - 21.0 - 10.0.17763.0 - 10.0.17763.0 - 6.5 - - - - false - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + $(VsInstallRoot)\Common7\IDE\Extensions\Microsoft\SQLDB + + + $(VsInstallRoot)\Common7\IDE\Extensions\Microsoft\SQLDB\DAC + + + 10.0 + + + net7.0-android;net7.0-ios;net7.0-maccatalyst + $(TargetFrameworks);net7.0-windows10.0.19041.0 + + + + Exe + ParionsCuite + true + true + enable + + ParionsCuite + + com.companyname.parionscuite + be941c7a-90b1-469a-aa20-94c786120159 + + 1.0 + 1 + 11.0 + 13.1 + 21.0 + 10.0.17763.0 + 10.0.17763.0 + 6.5 + + + false + + + false + + + + + + + + + + + + + + + + + + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(SSDTPath)\Microsoft.Data.Tools.Schema.Sql.dll + True + + + $(SSDTUnitTestPath)\Microsoft.Data.Tools.Schema.Sql.UnitTesting.dll + True + + + $(SSDTUnitTestPath)\Microsoft.Data.Tools.Schema.Sql.UnitTestingAdapter.dll + True + + + + 3.1 + + + + \ No newline at end of file diff --git a/ParionsCuite/ParionsCuite/Test/SqlDatabaseSetup.cs b/ParionsCuite/ParionsCuite/Test/SqlDatabaseSetup.cs new file mode 100644 index 0000000..b64d64a --- /dev/null +++ b/ParionsCuite/ParionsCuite/Test/SqlDatabaseSetup.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Data.Common; +using Microsoft.Data.Tools.Schema.Sql.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace ParionsCuite.Test +{ + [TestClass()] + public class SqlDatabaseSetup + { + + [AssemblyInitialize()] + public static void InitializeAssembly(TestContext ctx) + { + // Setup the test database based on setting in the + // configuration file + SqlDatabaseTestClass.TestService.DeployDatabaseProject(); + SqlDatabaseTestClass.TestService.GenerateData(); + } + + } +} diff --git a/ParionsCuite/ParionsCuite/Test/TestInitializeAttribute.cs b/ParionsCuite/ParionsCuite/Test/TestInitializeAttribute.cs new file mode 100644 index 0000000..e7c64b4 --- /dev/null +++ b/ParionsCuite/ParionsCuite/Test/TestInitializeAttribute.cs @@ -0,0 +1,6 @@ +namespace ParionsCuite.Test +{ + internal class TestInitializeAttribute : Attribute + { + } +} \ No newline at end of file diff --git a/ParionsCuite/ParionsCuite/Test/TestManager.cs b/ParionsCuite/ParionsCuite/Test/TestManager.cs new file mode 100644 index 0000000..a40ccda --- /dev/null +++ b/ParionsCuite/ParionsCuite/Test/TestManager.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.Common; +using System.Text; +using Microsoft.Data.Tools.Schema.Sql.UnitTesting; +using Microsoft.Data.Tools.Schema.Sql.UnitTesting.Conditions; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace ParionsCuite.Test +{ + [TestClass()] + public class TestManager : SqlDatabaseTestClass + { + + public TestManager() + { + InitializeComponent(); + } + + [TestInitialize()] + public void TestInitialize() + { + base.InitializeTest(); + } + [TestCleanup()] + public void TestCleanup() + { + base.CleanupTest(); + } + + [TestMethod()] + public void SqlTest1() + { + SqlDatabaseTestActions testActions = this.SqlTest1Data; + // Execute the pre-test script + // + System.Diagnostics.Trace.WriteLineIf((testActions.PretestAction != null), "Executing pre-test script..."); + SqlExecutionResult[] pretestResults = TestService.Execute(this.PrivilegedContext, this.PrivilegedContext, testActions.PretestAction); + // Execute the test script + // + System.Diagnostics.Trace.WriteLineIf((testActions.TestAction != null), "Executing test script..."); + SqlExecutionResult[] testResults = TestService.Execute(this.ExecutionContext, this.PrivilegedContext, testActions.TestAction); + // Execute the post-test script + // + System.Diagnostics.Trace.WriteLineIf((testActions.PosttestAction != null), "Executing post-test script..."); + SqlExecutionResult[] posttestResults = TestService.Execute(this.PrivilegedContext, this.PrivilegedContext, testActions.PosttestAction); + } + + #region Designer support code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SqlTest1Data = new SqlDatabaseTestActions(); + // + // SqlTest1Data + // + this.SqlTest1Data.PosttestAction = null; + this.SqlTest1Data.PretestAction = null; + this.SqlTest1Data.TestAction = null; + } + + #endregion + + + #region Additional test attributes + // + // You can use the following additional attributes as you write your tests: + // + // Use ClassInitialize to run code before running the first test in the class + // [ClassInitialize()] + // public static void MyClassInitialize(TestContext testContext) { } + // + // Use ClassCleanup to run code after all tests in a class have run + // [ClassCleanup()] + // public static void MyClassCleanup() { } + // + #endregion + + private SqlDatabaseTestActions SqlTest1Data; + } +} diff --git a/ParionsCuite/ParionsCuite/Test/app.config b/ParionsCuite/ParionsCuite/Test/app.config new file mode 100644 index 0000000..9ba3a34 --- /dev/null +++ b/ParionsCuite/ParionsCuite/Test/app.config @@ -0,0 +1,11 @@ + + + + + + + + \ No newline at end of file