diff --git a/Snowflake.Data.Tests/SFBaseTest.cs b/Snowflake.Data.Tests/SFBaseTest.cs index 5b3f8d45f..e791de352 100755 --- a/Snowflake.Data.Tests/SFBaseTest.cs +++ b/Snowflake.Data.Tests/SFBaseTest.cs @@ -187,9 +187,9 @@ public static void RecordTestPerformance(string name, TimeSpan time) public void Setup() { #if NETFRAMEWORK - Environment.SetEnvironmentVariable("net_test_framework", "net471"); + Environment.SetEnvironmentVariable("NET_TEST_FRAMEWORK", "net471"); #else - Environment.SetEnvironmentVariable("net_test_framework", "net6.0"); + Environment.SetEnvironmentVariable("NET_TEST_FRAMEWORK", "net6.0"); #endif ILoggerFactory factory = LoggerFactory.Create( builder => builder diff --git a/Snowflake.Data.Tests/TestLog4Net.config b/Snowflake.Data.Tests/TestLog4Net.config index 784355885..72de5b815 100644 --- a/Snowflake.Data.Tests/TestLog4Net.config +++ b/Snowflake.Data.Tests/TestLog4Net.config @@ -1,7 +1,7 @@ - + diff --git a/Snowflake.Data.Tests/TestNLog.config b/Snowflake.Data.Tests/TestNLog.config index 85c376043..6dd1b6ce8 100644 --- a/Snowflake.Data.Tests/TestNLog.config +++ b/Snowflake.Data.Tests/TestNLog.config @@ -10,7 +10,7 @@ diff --git a/Snowflake.Data.Tests/UnitTests/Logger/SFLoggerTest.cs b/Snowflake.Data.Tests/UnitTests/Logger/SFLoggerTest.cs index 0cd9ce014..37fd8a503 100644 --- a/Snowflake.Data.Tests/UnitTests/Logger/SFLoggerTest.cs +++ b/Snowflake.Data.Tests/UnitTests/Logger/SFLoggerTest.cs @@ -10,6 +10,7 @@ using Serilog; using Serilog.Extensions.Logging; using System.IO; +using System; namespace Snowflake.Data.Tests.UnitTests { @@ -22,6 +23,10 @@ class SFLoggerTest private const string ErrorMessage = "Error message"; private const string CriticalMessage = "critical message"; + private const string Log4NetFileName = "test_log4net.log"; + private const string SerilogFileName = "test_serilog.log"; + private const string NlogFileName = "test_nlog.log"; + public abstract class SFBaseLoggerTest { protected ILogger _logger; @@ -154,6 +159,7 @@ public class Log4NetTest : SFBaseLoggerTest [OneTimeSetUp] public void SetUp() { + Environment.SetEnvironmentVariable("TEST_LOG4NET_FILE_NAME", Log4NetFileName); var factory = LoggerFactory.Create( builder => builder .AddLog4Net("TestLog4Net.config") @@ -161,7 +167,7 @@ public void SetUp() var log4netLogger = factory.CreateLogger("Log4NetTest"); SFLoggerFactory.SetCustomLogger(log4netLogger); - _logFile = "test_log4net.log"; + _logFile = Log4NetFileName; } } @@ -173,11 +179,12 @@ public void SetUp() { var loggerSerilog = new LoggerConfiguration() .MinimumLevel.Verbose() - .WriteTo.File("test_serilog.log") + .WriteTo.File(SerilogFileName) .CreateLogger(); + var serilogLogger = new SerilogLoggerFactory(loggerSerilog).CreateLogger("SerilogTest"); SFLoggerFactory.SetCustomLogger(serilogLogger); - _logFile = "test_serilog.log"; + _logFile = SerilogFileName; } } @@ -187,6 +194,7 @@ public class NlogTest : SFBaseLoggerTest [OneTimeSetUp] public void SetUp() { + Environment.SetEnvironmentVariable("TEST_NLOG_FILE_NAME", NlogFileName); var factory = LoggerFactory.Create( builder => builder .AddNLog("TestNLog.config") @@ -194,7 +202,7 @@ public void SetUp() var nlogLogger = factory.CreateLogger("NlogTest"); SFLoggerFactory.SetCustomLogger(nlogLogger); - _logFile = "test_nlog.log"; + _logFile = NlogFileName; } } } diff --git a/Snowflake.Data.Tests/log4net.config b/Snowflake.Data.Tests/log4net.config index 0dffc1970..e461d54b5 100644 --- a/Snowflake.Data.Tests/log4net.config +++ b/Snowflake.Data.Tests/log4net.config @@ -1,7 +1,7 @@ - +