From 3bdd03b120c4f0cf4bd4b8d5dda753ec6e151b8c Mon Sep 17 00:00:00 2001 From: Egor Shokurov Date: Mon, 3 Jan 2022 19:43:30 +0300 Subject: [PATCH] Upgrade dependencies to modern SQLServer and PGSQL drivers Added NEtDateTimeKind to address TZ/noTZ ambiguity Address https://www.npgsql.org/doc/release-notes/6.0.html#major-changes-to-timestamp-mapping incopatibility Address https://github.com/dotnet/SqlClient/issues/1402 new SQL Server encryption defaults --- ETLBox/ETLBox.csproj | 20 +- .../ConnectionManager/DataTypeConverter.cs | 19 ++ .../ConnectionManager/DbConnectionManager.cs | 5 +- .../src/Definitions/Database/TableColumn.cs | 3 +- .../TestConnectionManager.csproj | 15 +- .../default.config.json-template | 8 +- .../TestControlFlowTasks.csproj | 15 +- .../default.config.json-template | 2 +- .../src/Postgres/TableDefinitionTests.cs | 10 +- .../src/SqlTaskBulkInsertTests.cs | 117 ++++----- .../src/SqlTaskInParallelTests.cs | 77 +++--- .../TestDatabaseConnectors.csproj | 15 +- .../default.config.json-template | 6 +- .../TestFlatFileConnectors.csproj | 17 +- .../default.config.json-template | 2 +- TestHelper/TestHelper.csproj | 15 +- TestNonParallel/TestNonParallel.csproj | 9 +- TestNonParallel/default.config.json-template | 4 +- TestNonParallel/docker.config.json-template | 4 +- .../TestOtherConnectors.csproj | 15 +- .../default.config.json-template | 2 +- TestPerformance/TestPerformance.csproj | 9 +- TestPerformance/default.config.json-template | 2 +- TestShared/TestShared.csproj | 17 +- TestShared/src/Helper/Config.cs | 231 ++++++++++-------- .../TestTransformations.csproj | 17 +- .../default.config.json-template | 2 +- .../RowDuplication/RowDuplicationEnumTests.cs | 91 ++++--- run-all-tests.ps1 | 22 +- 29 files changed, 439 insertions(+), 332 deletions(-) diff --git a/ETLBox/ETLBox.csproj b/ETLBox/ETLBox.csproj index 36f3ee39..b848968c 100644 --- a/ETLBox/ETLBox.csproj +++ b/ETLBox/ETLBox.csproj @@ -30,19 +30,19 @@ - + - + - - - - - + + + + + - - - + + + diff --git a/ETLBox/src/Definitions/ConnectionManager/DataTypeConverter.cs b/ETLBox/src/Definitions/ConnectionManager/DataTypeConverter.cs index 793ab5d8..2c5879be 100644 --- a/ETLBox/src/Definitions/ConnectionManager/DataTypeConverter.cs +++ b/ETLBox/src/Definitions/ConnectionManager/DataTypeConverter.cs @@ -165,5 +165,24 @@ public static string TryGetDBSpecificType(string dbSpecificTypeName, ConnectionM return dbSpecificTypeName; } } + + public static DateTimeKind? GetNETDateTimeKind(string dbSpecificTypeName) + { + switch (dbSpecificTypeName) + { + case "date": + case "datetime": + case "smalldatetime": + case "datetime2": + case "time": + case "timestamp": + return DateTimeKind.Unspecified; + case "timetz": + case "timestamptz": + return DateTimeKind.Utc; + default: + return null; + } + } } } diff --git a/ETLBox/src/Definitions/ConnectionManager/DbConnectionManager.cs b/ETLBox/src/Definitions/ConnectionManager/DbConnectionManager.cs index dbc393a5..7fd10501 100644 --- a/ETLBox/src/Definitions/ConnectionManager/DbConnectionManager.cs +++ b/ETLBox/src/Definitions/ConnectionManager/DbConnectionManager.cs @@ -108,7 +108,10 @@ public IDbCommand CreateCommand(string commandText, IEnumerable { var newPar = cmd.CreateParameter(); newPar.ParameterName = par.Name; - newPar.DbType = par.DBType; + newPar.DbType = ConnectionManagerType == ConnectionManagerType.Postgres && par.DBType == DbType.DateTime + ? DbType.DateTime2 // TODO: Move this hack to more appropriate place + // (fix for https://www.npgsql.org/doc/release-notes/6.0.html#major-changes-to-timestamp-mapping in NpgSql 6.0+) + : par.DBType; newPar.Value = par.Value; cmd.Parameters.Add(newPar); } diff --git a/ETLBox/src/Definitions/Database/TableColumn.cs b/ETLBox/src/Definitions/Database/TableColumn.cs index 8a274d20..1d97c815 100644 --- a/ETLBox/src/Definitions/Database/TableColumn.cs +++ b/ETLBox/src/Definitions/Database/TableColumn.cs @@ -18,8 +18,9 @@ public class TableColumn : ITableColumn, IColumnMapping public string DefaultValue { get; set; } public string Collation { get; set; } public string ComputedColumn { get; set; } - public bool HasComputedColumn => !String.IsNullOrWhiteSpace(ComputedColumn); + public bool HasComputedColumn => !string.IsNullOrWhiteSpace(ComputedColumn); public System.Type NETDataType => Type.GetType(DataTypeConverter.GetNETObjectTypeString(DataType)); + public DateTimeKind? NETDateTimeKind => DataTypeConverter.GetNETDateTimeKind(DataType); public string Comment { get; set; } //MySql only public int? IdentitySeed { get; set; } //Sql Server only diff --git a/TestConnectionManager/TestConnectionManager.csproj b/TestConnectionManager/TestConnectionManager.csproj index 7d962f5a..0d15dc3a 100644 --- a/TestConnectionManager/TestConnectionManager.csproj +++ b/TestConnectionManager/TestConnectionManager.csproj @@ -9,10 +9,17 @@ - - - - + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/TestConnectionManager/default.config.json-template b/TestConnectionManager/default.config.json-template index 2f02cdf5..bb254802 100644 --- a/TestConnectionManager/default.config.json-template +++ b/TestConnectionManager/default.config.json-template @@ -1,6 +1,6 @@ { "DataFlow": { - "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlow", + "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};TrustServerCertificate=true;User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlow", "SqlOdbcConnectionString": "Driver={SQL Server};Server=${CFG_MSSQL_IP};Database=ETLBox_DataFlow;Uid=sa;Pwd=YourStrong@Passw0rd;", "SQLiteConnectionString": "Data Source=.${CFG_PD}db${CFG_PD}SQLiteDataFlow.db;", "AccessOdbcConnectionString": "Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=.${CFG_PD}db${CFG_PD}AccessDataFlow.accdb", @@ -9,18 +9,18 @@ "AzureSqlConnectionString": "Server=tcp:etlbox.database.windows.net,1433;Initial Catalog=etlbox;Persist Security Info=False;User ID=etlboxadmin;Password=ETLBoxPassw0rd!;" }, "DataFlowSource": { - "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlowSource", + "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};TrustServerCertificate=true;User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlowSource", "SQLiteConnectionString": "Data Source=.${CFG_PD}db${CFG_PD}SQLiteDataFlowSource.db;", "MySqlConnectionString": "Server=${CFG_MYSQL_IP};Database=ETLBox_DataFlowSource;Uid=root;Pwd=etlboxpassword;", "PostgresConnectionString": "Server=${CFG_POSTGRES_IP};Database=ETLBox_DataFlowSource;User Id=postgres;Password=etlboxpassword;" }, "DataFlowDestination": { - "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlowDestination", + "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};TrustServerCertificate=true;User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlowDestination", "SQLiteConnectionString": "Data Source=.${CFG_PD}db${CFG_PD}SQLiteDataFlowDestination.db;", "MySqlConnectionString": "Server=${CFG_MYSQL_IP};Database=ETLBox_DataFlowDestination;Uid=root;Pwd=etlboxpassword;", "PostgresConnectionString": "Server=${CFG_POSTGRES_IP};Database=ETLBox_DataFlowDestination;User Id=postgres;Password=etlboxpassword;" }, "ConnectionManager": { - "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_ConnectionManager" + "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};TrustServerCertificate=true;User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_ConnectionManager" } } diff --git a/TestControlFlowTasks/TestControlFlowTasks.csproj b/TestControlFlowTasks/TestControlFlowTasks.csproj index 881860b2..aa6ffc12 100644 --- a/TestControlFlowTasks/TestControlFlowTasks.csproj +++ b/TestControlFlowTasks/TestControlFlowTasks.csproj @@ -9,10 +9,17 @@ - - - - + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/TestControlFlowTasks/default.config.json-template b/TestControlFlowTasks/default.config.json-template index af5693d1..92bba556 100644 --- a/TestControlFlowTasks/default.config.json-template +++ b/TestControlFlowTasks/default.config.json-template @@ -1,6 +1,6 @@ { "ControlFlow": { - "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_ControlFlow", + "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};TrustServerCertificate=true;User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_ControlFlow", "SSASConnectionString": "Data Source=.;Integrated Security=SSPI;Initial Catalog=ETLBox_ControlFlow", "SQLiteConnectionString": "Data Source=.${CFG_PD}db${CFG_PD}SQLiteControlFlow.db;", "AccessOdbcConnectionString": "Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=.${CFG_PD}db${CFG_PD}AccessControlFlow.accdb", diff --git a/TestControlFlowTasks/src/Postgres/TableDefinitionTests.cs b/TestControlFlowTasks/src/Postgres/TableDefinitionTests.cs index f963d788..c53bfde5 100644 --- a/TestControlFlowTasks/src/Postgres/TableDefinitionTests.cs +++ b/TestControlFlowTasks/src/Postgres/TableDefinitionTests.cs @@ -62,11 +62,11 @@ tswithtimezone TIMESTAMPTZ //Assert Assert.Collection(result.Columns, tc => Assert.True(tc.DataType == "date" && tc.NETDataType == typeof(DateTime)), - tc => Assert.True(tc.DataType == "time" && tc.NETDataType == typeof(DateTime)), - tc => Assert.True(tc.DataType == "timetz" && tc.NETDataType == typeof(DateTime)), - tc => Assert.True(tc.DataType == "interval" && tc.NETDataType == typeof(String)), - tc => Assert.True(tc.DataType == "timestamp" && tc.NETDataType == typeof(DateTime)), - tc => Assert.True(tc.DataType == "timestamptz" && tc.NETDataType == typeof(DateTime)) + tc => Assert.True(tc.DataType == "time" && tc.NETDataType == typeof(DateTime) && tc.NETDateTimeKind == DateTimeKind.Unspecified), + tc => Assert.True(tc.DataType == "timetz" && tc.NETDataType == typeof(DateTime) && tc.NETDateTimeKind == DateTimeKind.Utc), + tc => Assert.True(tc.DataType == "interval" && tc.NETDataType == typeof(String) && tc.NETDateTimeKind == null), + tc => Assert.True(tc.DataType == "timestamp" && tc.NETDataType == typeof(DateTime) && tc.NETDateTimeKind == DateTimeKind.Unspecified), + tc => Assert.True(tc.DataType == "timestamptz" && tc.NETDataType == typeof(DateTime) && tc.NETDateTimeKind == DateTimeKind.Utc) ); } diff --git a/TestControlFlowTasks/src/SqlTaskBulkInsertTests.cs b/TestControlFlowTasks/src/SqlTaskBulkInsertTests.cs index 3fffc2f9..45b08ad0 100644 --- a/TestControlFlowTasks/src/SqlTaskBulkInsertTests.cs +++ b/TestControlFlowTasks/src/SqlTaskBulkInsertTests.cs @@ -1,82 +1,87 @@ +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; using ALE.ETLBox; using ALE.ETLBox.ConnectionManager; using ALE.ETLBox.ControlFlow; using ALE.ETLBox.Helper; -using ALE.ETLBox.Logging; using ALE.ETLBoxTests.Fixtures; -using System; -using System.Collections.Generic; using Xunit; -namespace ALE.ETLBoxTests.ControlFlowTests +namespace ALE.ETLBoxTests.ControlFlowTests; + +[Collection("ControlFlow")] +public class SqlTaskBulkInsertTests { - [Collection("ControlFlow")] - public class SqlTaskBulkInsertTests + public SqlTaskBulkInsertTests(ControlFlowDatabaseFixture dbFixture) + { + } + + public static IEnumerable Connections => RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + ? Config.AllSqlConnections("ControlFlow").Concat(Config.AccessConnection("ControlFlow")) + : Config.AllSqlConnections("ControlFlow"); + + public static IEnumerable ConnectionsWithValue(int value) + { + return Config.AllSqlConnectionsWithValue("ControlFlow", value); + } + + + [Theory] + [MemberData(nameof(Connections))] + //If access fails with "Internal OLE Automation error", download and install: https://www.microsoft.com/en-us/download/confirmation.aspx?id=50040 + //see also: https://stackoverflow.com/questions/54632928/internal-ole-automation-error-in-ms-access-using-oledb + public void StringArray(IConnectionManager connection) { - public static IEnumerable Connections => Config.AllSqlConnections("ControlFlow"); - public static IEnumerable ConnectionsWithValue(int value) - => Config.AllSqlConnectionsWithValue("ControlFlow", value); - public static IEnumerable Access => Config.AccessConnection("ControlFlow"); + //Arrange + var destTable = new TwoColumnsTableFixture(connection, "BulkInsert2Columns"); - public SqlTaskBulkInsertTests(ControlFlowDatabaseFixture dbFixture) - { } + var data = new TableData(destTable.TableDefinition); + string[] values = { "1", "Test1" }; + data.Rows.Add(values); + string[] values2 = { "2", "Test2" }; + data.Rows.Add(values2); + string[] values3 = { "3", "Test3" }; + data.Rows.Add(values3); + //Act + SqlTask.BulkInsert(connection, "Bulk insert demo data", data, "BulkInsert2Columns"); - [Theory, MemberData(nameof(Connections)) - , MemberData(nameof(Access))] //If access fails with "Internal OLE Automation error", download and install: https://www.microsoft.com/en-us/download/confirmation.aspx?id=50040 - //see also: https://stackoverflow.com/questions/54632928/internal-ole-automation-error-in-ms-access-using-oledb + //Assert + destTable.AssertTestData(); - public void StringArray(IConnectionManager connection) + if (connection.GetType() == typeof(AccessOdbcConnectionManager)) + connection.Close(); + //Assert connection is closed + Assert.True(connection.State == null); + } + + [Theory] + [MemberData(nameof(ConnectionsWithValue), 0)] + [MemberData(nameof(ConnectionsWithValue), 2)] + [MemberData(nameof(ConnectionsWithValue), 3)] + public void WithIdentityShift(IConnectionManager connection, int identityIndex) + { + //SQLite does not support Batch Insert on Non Nullable Identity Columns + if (connection.GetType() != typeof(SQLiteConnectionManager)) { //Arrange - TwoColumnsTableFixture destTable = new TwoColumnsTableFixture(connection, "BulkInsert2Columns"); + var destTable = + new FourColumnsTableFixture(connection, "BulkInsert4Columns", identityIndex); - TableData data = new TableData(destTable.TableDefinition); - string[] values = { "1", "Test1" }; + var data = new TableData(destTable.TableDefinition, 2); + object[] values = { "Test1", null, 1.2 }; data.Rows.Add(values); - string[] values2 = { "2", "Test2" }; + object[] values2 = { "Test2", 4711, 1.23 }; data.Rows.Add(values2); - string[] values3 = { "3", "Test3" }; + object[] values3 = { "Test3", 185, 1.234 }; data.Rows.Add(values3); //Act - SqlTask.BulkInsert(connection, "Bulk insert demo data", data, "BulkInsert2Columns"); + SqlTask.BulkInsert(connection, "Bulk insert demo data", data, "BulkInsert4Columns"); //Assert destTable.AssertTestData(); - - if (connection.GetType() == typeof(AccessOdbcConnectionManager)) - connection.Close(); - //Assert connection is closed - Assert.True(connection.State == null); } - - [Theory, MemberData(nameof(ConnectionsWithValue), 0), - MemberData(nameof(ConnectionsWithValue), 2), - MemberData(nameof(ConnectionsWithValue), 3)] - public void WithIdentityShift(IConnectionManager connection, int identityIndex) - { - //SQLite does not support Batch Insert on Non Nullable Identity Columns - if (connection.GetType() != typeof(SQLiteConnectionManager)) - { - //Arrange - FourColumnsTableFixture destTable = new FourColumnsTableFixture(connection, "BulkInsert4Columns", identityIndex); - - TableData data = new TableData(destTable.TableDefinition, 2); - object[] values = { "Test1", null, 1.2 }; - data.Rows.Add(values); - object[] values2 = { "Test2", 4711, 1.23 }; - data.Rows.Add(values2); - object[] values3 = { "Test3", 185, 1.234 }; - data.Rows.Add(values3); - - //Act - SqlTask.BulkInsert(connection, "Bulk insert demo data", data, "BulkInsert4Columns"); - - //Assert - destTable.AssertTestData(); - } - } - } -} +} \ No newline at end of file diff --git a/TestControlFlowTasks/src/SqlTaskInParallelTests.cs b/TestControlFlowTasks/src/SqlTaskInParallelTests.cs index 0f945daf..6d119f23 100644 --- a/TestControlFlowTasks/src/SqlTaskInParallelTests.cs +++ b/TestControlFlowTasks/src/SqlTaskInParallelTests.cs @@ -1,49 +1,49 @@ +using System.Collections.Generic; +using System.Threading.Tasks; using ALE.ETLBox; using ALE.ETLBox.ConnectionManager; using ALE.ETLBox.ControlFlow; using ALE.ETLBox.Helper; -using ALE.ETLBox.Logging; using ALE.ETLBoxTests.Fixtures; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; using TestShared.Attributes; using Xunit; -namespace ALE.ETLBoxTests.ControlFlowTests +namespace ALE.ETLBoxTests.ControlFlowTests; + +[Collection("ControlFlow")] +public class SqlTaskInParallelTests { - [Collection("ControlFlow")] - public class SqlTaskInParallelTests + public SqlTaskInParallelTests(ControlFlowDatabaseFixture dbFixture) { - public SqlConnectionManager Connection => Config.SqlConnection.ConnectionManager("ControlFlow"); - public SqlTaskInParallelTests(ControlFlowDatabaseFixture dbFixture) - { - CreateTableTask.Create(Connection, "FastParallel", - new List() { new TableColumn("id", "int") }); - } + CreateTableTask.Create(Connection, "FastParallel", + new List { new("id", "int") }); + } + + public SqlConnectionManager Connection => Config.SqlConnection.ConnectionManager("ControlFlow"); - [MultiprocessorOnlyFact] - public void FastExecutingSqlsInParallel() - { - //Arrange - List array = new List() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - //Act - Parallel.ForEach(array, new ParallelOptions { MaxDegreeOfParallelism = 8 }, - curNr => SqlTask.ExecuteNonQuery(Connection, $"Test statement {curNr}", + [MultiprocessorOnlyFact] + public void FastExecutingSqlsInParallel() + { + //Arrange + var array = new List { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + //Act + Parallel.ForEach(array, new ParallelOptions { MaxDegreeOfParallelism = 8 }, + curNr => SqlTask.ExecuteNonQuery(Connection, $"Test statement {curNr}", $"INSERT INTO FastParallel VALUES({curNr})") - ); - //Assert - Assert.Equal(10, RowCountTask.Count(Connection, "FastParallel")); - } + ); + //Assert + Assert.Equal(10, RowCountTask.Count(Connection, "FastParallel")); + } - [MultiprocessorOnlyFact] - public void LongExecutingSqlTaskInParallel() - { - //Arrange - List array = new List() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - //Act - Parallel.ForEach(array, new ParallelOptions { MaxDegreeOfParallelism = 8 }, - curNr => SqlTask.ExecuteNonQuery(Connection, $"Test statement {curNr}", $@" + [MultiprocessorOnlyFact] + [Trait("Category", "Performance")] + public void LongExecutingSqlTaskInParallel() + { + //Arrange + var array = new List { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + //Act + Parallel.ForEach(array, new ParallelOptions { MaxDegreeOfParallelism = 8 }, + curNr => SqlTask.ExecuteNonQuery(Connection, $"Test statement {curNr}", $@" DECLARE @counter INT = 0; CREATE TABLE dbo.LongParallel{curNr} ( Col1 nvarchar(50) @@ -54,10 +54,9 @@ WHILE @counter < 5000 INSERT INTO dbo.LongParallel{curNr} values('Lorem ipsum Lorem ipsum Lorem ipsum Lorem') END ") - ); - //Assert - Parallel.ForEach(array,curNr => - Assert.Equal(5000, RowCountTask.Count(Connection, $"LongParallel{curNr}"))); - } + ); + //Assert + Parallel.ForEach(array, curNr => + Assert.Equal(5000, RowCountTask.Count(Connection, $"LongParallel{curNr}"))); } -} +} \ No newline at end of file diff --git a/TestDatabaseConnectors/TestDatabaseConnectors.csproj b/TestDatabaseConnectors/TestDatabaseConnectors.csproj index ab80e3fc..9a170105 100644 --- a/TestDatabaseConnectors/TestDatabaseConnectors.csproj +++ b/TestDatabaseConnectors/TestDatabaseConnectors.csproj @@ -10,10 +10,17 @@ - - - - + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/TestDatabaseConnectors/default.config.json-template b/TestDatabaseConnectors/default.config.json-template index 16fa446e..212da535 100644 --- a/TestDatabaseConnectors/default.config.json-template +++ b/TestDatabaseConnectors/default.config.json-template @@ -1,6 +1,6 @@ { "DataFlow": { - "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlow", + "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};TrustServerCertificate=true;User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlow", "SqlOdbcConnectionString": "Driver={SQL Server};Server=${CFG_MSSQL_IP};Database=ETLBox_DataFlow;Uid=sa;Pwd=YourStrong@Passw0rd;", "SQLiteConnectionString": "Data Source=.${CFG_PD}db${CFG_PD}SQLiteDataFlow.db;", "AccessOdbcConnectionString": "Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=.${CFG_PD}db${CFG_PD}AccessDataFlow.accdb", @@ -9,13 +9,13 @@ "AzureSqlConnectionString": "Server=tcp:etlbox.database.windows.net,1433;Initial Catalog=etlbox;Persist Security Info=False;User ID=etlboxadmin;Password=ETLBoxPassw0rd!;" }, "DataFlowSource": { - "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlowSource", + "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};TrustServerCertificate=true;User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlowSource", "SQLiteConnectionString": "Data Source=.${CFG_PD}db${CFG_PD}SQLiteDataFlowSource.db;", "MySqlConnectionString": "Server=${CFG_MYSQL_IP};Database=ETLBox_DataFlowSource;Uid=root;Pwd=etlboxpassword;", "PostgresConnectionString": "Server=${CFG_POSTGRES_IP};Database=ETLBox_DataFlowSource;User Id=postgres;Password=etlboxpassword;" }, "DataFlowDestination": { - "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlowDestination", + "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};TrustServerCertificate=true;User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlowDestination", "SQLiteConnectionString": "Data Source=.${CFG_PD}db${CFG_PD}SQLiteDataFlowDestination.db;", "MySqlConnectionString": "Server=${CFG_MYSQL_IP};Database=ETLBox_DataFlowDestination;Uid=root;Pwd=etlboxpassword;", "PostgresConnectionString": "Server=${CFG_POSTGRES_IP};Database=ETLBox_DataFlowDestination;User Id=postgres;Password=etlboxpassword;" diff --git a/TestFlatFileConnectors/TestFlatFileConnectors.csproj b/TestFlatFileConnectors/TestFlatFileConnectors.csproj index d2e6918e..074744b1 100644 --- a/TestFlatFileConnectors/TestFlatFileConnectors.csproj +++ b/TestFlatFileConnectors/TestFlatFileConnectors.csproj @@ -9,12 +9,19 @@ - - + + + - - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/TestFlatFileConnectors/default.config.json-template b/TestFlatFileConnectors/default.config.json-template index 8bb1b677..ab6110a9 100644 --- a/TestFlatFileConnectors/default.config.json-template +++ b/TestFlatFileConnectors/default.config.json-template @@ -1,6 +1,6 @@ { "DataFlow": { - "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlow", + "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};TrustServerCertificate=true;User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlow", "SqlOdbcConnectionString": "Driver={SQL Server};Server=${CFG_MSSQL_IP};Database=ETLBox_DataFlow;Uid=sa;Pwd=YourStrong@Passw0rd;", "SQLiteConnectionString": "Data Source=.${CFG_PD}db${CFG_PD}SQLiteDataFlow.db;", "AccessOdbcConnectionString": "Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=.${CFG_PD}db${CFG_PD}AccessDataFlow.accdb", diff --git a/TestHelper/TestHelper.csproj b/TestHelper/TestHelper.csproj index 39f7ac4a..159d1d12 100644 --- a/TestHelper/TestHelper.csproj +++ b/TestHelper/TestHelper.csproj @@ -9,10 +9,17 @@ - - - - + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/TestNonParallel/TestNonParallel.csproj b/TestNonParallel/TestNonParallel.csproj index 5c0fb5a1..1dbe2ca3 100644 --- a/TestNonParallel/TestNonParallel.csproj +++ b/TestNonParallel/TestNonParallel.csproj @@ -17,9 +17,14 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/TestNonParallel/default.config.json-template b/TestNonParallel/default.config.json-template index f67b6268..f0a5ecfc 100644 --- a/TestNonParallel/default.config.json-template +++ b/TestNonParallel/default.config.json-template @@ -1,11 +1,11 @@ { "Logging": { - "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_Logging", + "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};TrustServerCertificate=true;User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_Logging", "SQLiteConnectionString": "Data Source=.${CFG_PD}db${CFG_PD}SQLiteLogging.db;", "MySqlConnectionString": "Server=${CFG_MYSQL_IP};Database=ETLBox_Logging;Uid=root;Pwd=etlboxpassword;", "PostgresConnectionString": "Server=${CFG_POSTGRES_IP};Database=ETLBox_Logging;User Id=postgres;Password=etlboxpassword;" }, "NoLog": { - "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_NoLog" + "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};TrustServerCertificate=true;User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_NoLog" } } diff --git a/TestNonParallel/docker.config.json-template b/TestNonParallel/docker.config.json-template index f67b6268..f0a5ecfc 100644 --- a/TestNonParallel/docker.config.json-template +++ b/TestNonParallel/docker.config.json-template @@ -1,11 +1,11 @@ { "Logging": { - "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_Logging", + "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};TrustServerCertificate=true;User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_Logging", "SQLiteConnectionString": "Data Source=.${CFG_PD}db${CFG_PD}SQLiteLogging.db;", "MySqlConnectionString": "Server=${CFG_MYSQL_IP};Database=ETLBox_Logging;Uid=root;Pwd=etlboxpassword;", "PostgresConnectionString": "Server=${CFG_POSTGRES_IP};Database=ETLBox_Logging;User Id=postgres;Password=etlboxpassword;" }, "NoLog": { - "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_NoLog" + "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};TrustServerCertificate=true;User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_NoLog" } } diff --git a/TestOtherConnectors/TestOtherConnectors.csproj b/TestOtherConnectors/TestOtherConnectors.csproj index 891c9738..a74b8d6e 100644 --- a/TestOtherConnectors/TestOtherConnectors.csproj +++ b/TestOtherConnectors/TestOtherConnectors.csproj @@ -9,10 +9,17 @@ - - - - + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/TestOtherConnectors/default.config.json-template b/TestOtherConnectors/default.config.json-template index 8bb1b677..ab6110a9 100755 --- a/TestOtherConnectors/default.config.json-template +++ b/TestOtherConnectors/default.config.json-template @@ -1,6 +1,6 @@ { "DataFlow": { - "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlow", + "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};TrustServerCertificate=true;User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlow", "SqlOdbcConnectionString": "Driver={SQL Server};Server=${CFG_MSSQL_IP};Database=ETLBox_DataFlow;Uid=sa;Pwd=YourStrong@Passw0rd;", "SQLiteConnectionString": "Data Source=.${CFG_PD}db${CFG_PD}SQLiteDataFlow.db;", "AccessOdbcConnectionString": "Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=.${CFG_PD}db${CFG_PD}AccessDataFlow.accdb", diff --git a/TestPerformance/TestPerformance.csproj b/TestPerformance/TestPerformance.csproj index fb3b4c1e..20529423 100644 --- a/TestPerformance/TestPerformance.csproj +++ b/TestPerformance/TestPerformance.csproj @@ -13,9 +13,14 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/TestPerformance/default.config.json-template b/TestPerformance/default.config.json-template index 81148a0b..413852a4 100644 --- a/TestPerformance/default.config.json-template +++ b/TestPerformance/default.config.json-template @@ -1,6 +1,6 @@ { "Performance": { - "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_Performance", + "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};TrustServerCertificate=true;User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_Performance", "SqlOdbcConnectionString": "Driver={SQL Server};Server=${CFG_MSSQL_IP};Database=ETLBox_Performance;Trusted_Connection=Yes", "AccessOdbcConnectionString": "Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=.${CFG_PD}db${CFG_PD}AccessPerformance.mdb", "MySqlConnectionString": "Server=${CFG_MYSQL_IP};Database=ETLBox_Performance;Uid=root;Pwd=etlboxpassword;", diff --git a/TestShared/TestShared.csproj b/TestShared/TestShared.csproj index b548c606..fb752346 100644 --- a/TestShared/TestShared.csproj +++ b/TestShared/TestShared.csproj @@ -9,11 +9,18 @@ - - - - - + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/TestShared/src/Helper/Config.cs b/TestShared/src/Helper/Config.cs index 0731520c..d3499a6e 100644 --- a/TestShared/src/Helper/Config.cs +++ b/TestShared/src/Helper/Config.cs @@ -1,145 +1,166 @@ -using ALE.ETLBox.ConnectionManager; -using Microsoft.Extensions.Configuration; -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Runtime.InteropServices; +using ALE.ETLBox.ConnectionManager; +using Microsoft.Extensions.Configuration; -namespace ALE.ETLBox.Helper -{ - public static class Config - { - public class ConnectionDetails - where TConnectionString : IDbConnectionString, new() - where TConnectionManager : IConnectionManager, new() - { - public string ConnectionStringName { get; set; } +namespace ALE.ETLBox.Helper; - public ConnectionDetails(string connectionStringName) - { - this.ConnectionStringName = connectionStringName; - } +public static class Config +{ + private static IConfigurationRoot _defaultConfigFile; - public string RawConnectionString(string section) - => Config.DefaultConfigFile.GetSection(section)[ConnectionStringName]; + public static ConnectionDetails SqlConnection { get; } = + new("SqlConnectionString"); - public TConnectionString ConnectionString(string section) - => new TConnectionString() { Value = RawConnectionString(section) }; + public static ConnectionDetails SSASConnection { get; } = + new("SSASConnectionString"); - public TConnectionManager ConnectionManager(string section) - => new TConnectionManager() { ConnectionString = ConnectionString(section) }; - } + public static ConnectionDetails + SQLiteConnection { get; set; } = + new("SQLiteConnectionString"); - public static ConnectionDetails SqlConnection { get; set; } = - new ConnectionDetails("SqlConnectionString"); + public static ConnectionDetails MySqlConnection { get; } = + new("MySqlConnectionString"); - public static ConnectionDetails SSASConnection { get; set; } = - new ConnectionDetails("SSASConnectionString"); + public static ConnectionDetails PostgresConnection + { + get; + } = new("PostgresConnectionString"); - public static ConnectionDetails - SQLiteConnection { get; set; } = - new ConnectionDetails("SQLiteConnectionString"); + public static ConnectionDetails AccessOdbcConnection + { + get; + } = new("AccessOdbcConnectionString"); - public static ConnectionDetails MySqlConnection { get; set; } = - new ConnectionDetails("MySqlConnectionString"); + public static ConnectionDetails + SqlOdbcConnection { get; } = new("SqlOdbcConnectionString"); - public static ConnectionDetails PostgresConnection - { - get; - set; - } = new ConnectionDetails("PostgresConnectionString"); + public static ConnectionDetails AzureSqlConnection { get; } = + new("AzureSqlConnectionString"); - public static ConnectionDetails AccessOdbcConnection + private static IConfigurationRoot DefaultConfigFile + { + get { - get; - set; - } = new ConnectionDetails("AccessOdbcConnectionString"); - - public static ConnectionDetails - SqlOdbcConnection { get; set; } = - new ConnectionDetails("SqlOdbcConnectionString"); + if (_defaultConfigFile == null) + { + var environmentVariable = Environment.GetEnvironmentVariable("ETLBoxConfig"); + var path = string.IsNullOrWhiteSpace(environmentVariable) ? "default.config.json" : environmentVariable; + Load(path); + } - public static ConnectionDetails AzureSqlConnection { get; set; } = - new ConnectionDetails("AzureSqlConnectionString"); + return _defaultConfigFile; + } + set => _defaultConfigFile = value; + } - public static IEnumerable AllSqlConnections(string section) => new[] + public static IEnumerable AllSqlConnections(string section) + { + return new[] { - new object[] { (IConnectionManager)SqlConnection.ConnectionManager(section) }, - new object[] { (IConnectionManager)PostgresConnection.ConnectionManager(section) }, - new object[] { (IConnectionManager)MySqlConnection.ConnectionManager(section) }, - new object[] { (IConnectionManager)SQLiteConnection.ConnectionManager(section) }, + new object[] { SqlConnection.ConnectionManager(section) }, + new object[] { PostgresConnection.ConnectionManager(section) }, + new object[] { MySqlConnection.ConnectionManager(section) }, + new object[] { SQLiteConnection.ConnectionManager(section) } }; + } - public static IEnumerable AllConnectionsWithoutSQLite(string section) => new[] + public static IEnumerable AllConnectionsWithoutSQLite(string section) + { + return new[] { - new object[] { (IConnectionManager)SqlConnection.ConnectionManager(section) }, - new object[] { (IConnectionManager)PostgresConnection.ConnectionManager(section) }, - new object[] { (IConnectionManager)MySqlConnection.ConnectionManager(section) }, + new object[] { SqlConnection.ConnectionManager(section) }, + new object[] { PostgresConnection.ConnectionManager(section) }, + new object[] { MySqlConnection.ConnectionManager(section) } }; + } - public static IEnumerable AllSqlConnectionsWithValue(string section, string value) => new[] + public static IEnumerable AllSqlConnectionsWithValue(string section, string value) + { + return new[] { - new object[] { (IConnectionManager)SqlConnection.ConnectionManager(section), value }, - new object[] { (IConnectionManager)PostgresConnection.ConnectionManager(section), value }, - new object[] { (IConnectionManager)MySqlConnection.ConnectionManager(section), value }, - new object[] { (IConnectionManager)SQLiteConnection.ConnectionManager(section), value }, + new object[] { SqlConnection.ConnectionManager(section), value }, + new object[] { PostgresConnection.ConnectionManager(section), value }, + new object[] { MySqlConnection.ConnectionManager(section), value }, + new object[] { SQLiteConnection.ConnectionManager(section), value } }; + } - public static IEnumerable AllSqlConnectionsWithValue(string section, int value) => new[] + public static IEnumerable AllSqlConnectionsWithValue(string section, int value) + { + return new[] { - new object[] { (IConnectionManager)SqlConnection.ConnectionManager(section), value }, - new object[] { (IConnectionManager)PostgresConnection.ConnectionManager(section), value }, - new object[] { (IConnectionManager)MySqlConnection.ConnectionManager(section), value }, - new object[] { (IConnectionManager)SQLiteConnection.ConnectionManager(section), value } + new object[] { SqlConnection.ConnectionManager(section), value }, + new object[] { PostgresConnection.ConnectionManager(section), value }, + new object[] { MySqlConnection.ConnectionManager(section), value }, + new object[] { SQLiteConnection.ConnectionManager(section), value } }; + } - public static IEnumerable AllOdbcConnections(string section) => - RuntimeInformation.IsOSPlatform(OSPlatform.Windows) - ? new[] - { - new object[] { (IConnectionManager)SqlOdbcConnection.ConnectionManager(section) }, - new object[] { (IConnectionManager)AccessOdbcConnection.ConnectionManager(section) } - } - : Array.Empty(); - - public static IEnumerable AccessConnection(string section) => - RuntimeInformation.IsOSPlatform(OSPlatform.Windows) - ? new[] - { - new object[] { (IConnectionManager)AccessOdbcConnection.ConnectionManager(section) } - } - : Array.Empty(); - - static IConfigurationRoot _defaultConfigFile; - - public static IConfigurationRoot DefaultConfigFile - { - get + public static IEnumerable AllOdbcConnections(string section) + { + return RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + ? new[] { - if (_defaultConfigFile == null) - { - var envvar = Environment.GetEnvironmentVariable("ETLBoxConfig"); - var path = string.IsNullOrWhiteSpace(envvar) ? $"default.config.json" : envvar; - Load(path); - } - - return _defaultConfigFile; + new object[] { SqlOdbcConnection.ConnectionManager(section) }, + new object[] { AccessOdbcConnection.ConnectionManager(section) } } - set { _defaultConfigFile = value; } - } + : Array.Empty(); + } - public static void Load(string configFile) - { - DefaultConfigFile = new ConfigurationBuilder() - .AddJsonFile(configFile) - .Build(); - } + public static IEnumerable AccessConnection(string section) + { + return RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + ? new[] + { + new object[] { AccessOdbcConnection.ConnectionManager(section) } + } + : Array.Empty(); + } + + public static void Load(string configFile) + { + DefaultConfigFile = new ConfigurationBuilder() + .AddJsonFile(configFile) + .Build(); + } - public static IEnumerable AllLocalCultures() => new[] + public static IEnumerable AllLocalCultures() + { + return new[] { CultureInfo.GetCultureInfo("ru-RU"), CultureInfo.GetCultureInfo("en-US") }; } + + public class ConnectionDetails + where TConnectionString : IDbConnectionString, new() + where TConnectionManager : IConnectionManager, new() + { + public ConnectionDetails(string connectionStringName) + { + ConnectionStringName = connectionStringName; + } + + public string ConnectionStringName { get; set; } + + public string RawConnectionString(string section) + { + return DefaultConfigFile.GetSection(section)[ConnectionStringName]; + } + + public TConnectionString ConnectionString(string section) + { + return new TConnectionString() { Value = RawConnectionString(section) }; + } + + public TConnectionManager ConnectionManager(string section) + { + return new TConnectionManager() { ConnectionString = ConnectionString(section) }; + } + } } \ No newline at end of file diff --git a/TestTransformations/TestTransformations.csproj b/TestTransformations/TestTransformations.csproj index aab425dd..3096e4b6 100644 --- a/TestTransformations/TestTransformations.csproj +++ b/TestTransformations/TestTransformations.csproj @@ -9,11 +9,18 @@ - - - - - + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/TestTransformations/default.config.json-template b/TestTransformations/default.config.json-template index 8bb1b677..ab6110a9 100644 --- a/TestTransformations/default.config.json-template +++ b/TestTransformations/default.config.json-template @@ -1,6 +1,6 @@ { "DataFlow": { - "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlow", + "SqlConnectionString": "Data Source=${CFG_MSSQL_IP};TrustServerCertificate=true;User Id=sa;Password=YourStrong@Passw0rd;Initial Catalog=ETLBox_DataFlow", "SqlOdbcConnectionString": "Driver={SQL Server};Server=${CFG_MSSQL_IP};Database=ETLBox_DataFlow;Uid=sa;Pwd=YourStrong@Passw0rd;", "SQLiteConnectionString": "Data Source=.${CFG_PD}db${CFG_PD}SQLiteDataFlow.db;", "AccessOdbcConnectionString": "Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=.${CFG_PD}db${CFG_PD}AccessDataFlow.accdb", diff --git a/TestTransformations/src/RowDuplication/RowDuplicationEnumTests.cs b/TestTransformations/src/RowDuplication/RowDuplicationEnumTests.cs index a0ce0ec4..cda0a025 100644 --- a/TestTransformations/src/RowDuplication/RowDuplicationEnumTests.cs +++ b/TestTransformations/src/RowDuplication/RowDuplicationEnumTests.cs @@ -1,59 +1,50 @@ -using ALE.ETLBox; using ALE.ETLBox.ConnectionManager; -using ALE.ETLBox.ControlFlow; using ALE.ETLBox.DataFlow; using ALE.ETLBox.Helper; -using ALE.ETLBox.Logging; using ALE.ETLBoxTests.Fixtures; -using Newtonsoft.Json; -using Npgsql.TypeHandlers; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; using Xunit; -namespace ALE.ETLBoxTests.DataFlowTests +namespace ALE.ETLBoxTests.DataFlowTests; + +[Collection("DataFlow")] +public class RowDuplicationEnumTests { - [Collection("DataFlow")] - public class RowDuplicationEnumTests + public enum EnumType + { + Value1 = 1, + Value2 = 2 + } + + public RowDuplicationEnumTests(DataFlowDatabaseFixture dbFixture) + { + } + + public SqlConnectionManager SqlConnection => Config.SqlConnection.ConnectionManager("DataFlow"); + + [Fact] + public void NoParameter() + { + //Arrange + var source = new MemorySource(); + source.DataAsList.Add(new MyEnumRow { EnumCol = EnumType.Value2 }); + var duplication = new RowDuplication(); + var dest = new MemoryDestination(); + + //Act + source.LinkTo(duplication); + duplication.LinkTo(dest); + source.Execute(); + dest.Wait(); + + //Assert + Assert.Collection(dest.Data, + d => Assert.True(d.EnumCol == EnumType.Value2), + d => Assert.True(d.EnumCol == EnumType.Value2) + ); + } + + public class MyEnumRow { - public SqlConnectionManager SqlConnection => Config.SqlConnection.ConnectionManager("DataFlow"); - public RowDuplicationEnumTests(DataFlowDatabaseFixture dbFixture) - { - } - - public class MyEnumRow - { - public EnumType EnumCol { get; set; } - } - - public enum EnumType - { - Value1 = 1, - Value2 = 2 - } - - [Fact] - public void NoParameter() - { - //Arrange - MemorySource source = new MemorySource(); - source.DataAsList.Add(new MyEnumRow() { EnumCol = EnumType.Value2 }); - RowDuplication duplication = new RowDuplication(); - MemoryDestination dest = new MemoryDestination(); - - //Act - source.LinkTo(duplication); - duplication.LinkTo(dest); - source.Execute(); - dest.Wait(); - - //Assert - Assert.Collection(dest.Data, - d => Assert.True(d.EnumCol == EnumType.Value2), - d => Assert.True(d.EnumCol == EnumType.Value2) - ); - } + public EnumType EnumCol { get; set; } } -} +} \ No newline at end of file diff --git a/run-all-tests.ps1 b/run-all-tests.ps1 index f259daba..d02a2935 100755 --- a/run-all-tests.ps1 +++ b/run-all-tests.ps1 @@ -1,12 +1,14 @@ #!/usr/bin/env pwsh -dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --filter "Category!=Performance" ./TestConnectionManager -dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --filter "Category!=Performance" ./TestControlFlowTasks -dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --filter "Category!=Performance" ./TestDatabaseConnectors -dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --filter "Category!=Performance" ./TestFlatFileConnectors -dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --filter "Category!=Performance" ./TestHelper -dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --filter "Category!=Performance" ./TestNonParallel -dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --filter "Category!=Performance" ./TestOtherConnectors -dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --filter "Category!=Performance" ./TestPerformance -dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --filter "Category!=Performance" ./TestShared -dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --filter "Category!=Performance" ./TestTransformations \ No newline at end of file +$options = @("-c", "Release", "/p:CollectCoverage=true", "/p:CoverletOutputFormat=opencover", "--filter", "Category!=Performance", "--no-build", "--logger", "console;verbosity=detailed") + +dotnet test ./TestConnectionManager $options +dotnet test ./TestControlFlowTasks $options +dotnet test ./TestDatabaseConnectors $options +dotnet test ./TestFlatFileConnectors $options +dotnet test ./TestHelper $options +dotnet test ./TestNonParallel $options +dotnet test ./TestOtherConnectors $options +dotnet test ./TestPerformance $options +dotnet test ./TestShared $options +dotnet test ./TestTransformations $options \ No newline at end of file