From 7a8f9566f1338bed0319cbe8d55928bd93cf608f Mon Sep 17 00:00:00 2001 From: Krzysztof Nozderko Date: Tue, 11 Jun 2024 12:07:39 +0000 Subject: [PATCH] Fix nunit usage after bump to 4.1.0 --- .../ConnectionMultiplePoolsAsyncIT.cs | 2 +- .../IntegrationTests/ConnectionMultiplePoolsIT.cs | 2 ++ .../ConnectionPoolChangedSessionIT.cs | 1 + .../IntegrationTests/ConnectionPoolCommonIT.cs | 1 + .../ConnectionSinglePoolCacheAsyncIT.cs | 2 +- .../UnitTests/ConnectionCacheManagerTest.cs | 1 + .../UnitTests/ConnectionPoolManagerTest.cs | 1 + .../Session/ConnectionPoolConfigExtractorTest.cs | 1 + .../UnitTests/Session/FixedZeroCounterTest.cs | 1 + .../NonCountingSessionCreationTokenCounterTest.cs | 15 ++++++++------- .../UnitTests/Session/NonNegativeCounterTest.cs | 1 + .../UnitTests/Session/NonWaitingQueueTest.cs | 1 + .../Session/SessionCreationTokenCounterTest.cs | 1 + .../UnitTests/Session/SessionCreationTokenTest.cs | 7 ++++--- .../Session/SessionOrCreationTokensTest.cs | 15 ++++++++------- .../UnitTests/Session/SessionPoolTest.cs | 1 + ...ionPropertiesWithDefaultValuesExtractorTest.cs | 1 + .../UnitTests/Session/WaitingQueueTest.cs | 1 + .../UnitTests/SnowflakeDbConnectionPoolTest.cs | 1 + .../UnitTests/Tools/SecureStringHelperTest.cs | 1 + .../UnitTests/Tools/TimeoutHelperTest.cs | 1 + Snowflake.Data.Tests/Util/AwaiterTest.cs | 11 ++++++----- 22 files changed, 45 insertions(+), 24 deletions(-) diff --git a/Snowflake.Data.Tests/IntegrationTests/ConnectionMultiplePoolsAsyncIT.cs b/Snowflake.Data.Tests/IntegrationTests/ConnectionMultiplePoolsAsyncIT.cs index aa5d431ed..dd2b29d22 100644 --- a/Snowflake.Data.Tests/IntegrationTests/ConnectionMultiplePoolsAsyncIT.cs +++ b/Snowflake.Data.Tests/IntegrationTests/ConnectionMultiplePoolsAsyncIT.cs @@ -4,11 +4,11 @@ using Moq; using NUnit.Framework; using Snowflake.Data.Client; -using Snowflake.Data.Core; using Snowflake.Data.Core.Session; using Snowflake.Data.Log; using Snowflake.Data.Tests.Mock; using Snowflake.Data.Tests.Util; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.IntegrationTests { diff --git a/Snowflake.Data.Tests/IntegrationTests/ConnectionMultiplePoolsIT.cs b/Snowflake.Data.Tests/IntegrationTests/ConnectionMultiplePoolsIT.cs index 4b7ec61f0..aebc1b7c8 100644 --- a/Snowflake.Data.Tests/IntegrationTests/ConnectionMultiplePoolsIT.cs +++ b/Snowflake.Data.Tests/IntegrationTests/ConnectionMultiplePoolsIT.cs @@ -10,6 +10,8 @@ using Snowflake.Data.Core.Session; using Snowflake.Data.Tests.Mock; using Snowflake.Data.Tests.Util; +using NUnit.Framework.Legacy; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.IntegrationTests { diff --git a/Snowflake.Data.Tests/IntegrationTests/ConnectionPoolChangedSessionIT.cs b/Snowflake.Data.Tests/IntegrationTests/ConnectionPoolChangedSessionIT.cs index 801916cb0..1d9817544 100644 --- a/Snowflake.Data.Tests/IntegrationTests/ConnectionPoolChangedSessionIT.cs +++ b/Snowflake.Data.Tests/IntegrationTests/ConnectionPoolChangedSessionIT.cs @@ -3,6 +3,7 @@ using Snowflake.Data.Core; using Snowflake.Data.Core.Session; using Snowflake.Data.Tests.Util; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.IntegrationTests { diff --git a/Snowflake.Data.Tests/IntegrationTests/ConnectionPoolCommonIT.cs b/Snowflake.Data.Tests/IntegrationTests/ConnectionPoolCommonIT.cs index 6a0745b23..214cbc0ca 100644 --- a/Snowflake.Data.Tests/IntegrationTests/ConnectionPoolCommonIT.cs +++ b/Snowflake.Data.Tests/IntegrationTests/ConnectionPoolCommonIT.cs @@ -11,6 +11,7 @@ using Snowflake.Data.Core.Session; using Snowflake.Data.Log; using Snowflake.Data.Tests.Util; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.IntegrationTests { diff --git a/Snowflake.Data.Tests/IntegrationTests/ConnectionSinglePoolCacheAsyncIT.cs b/Snowflake.Data.Tests/IntegrationTests/ConnectionSinglePoolCacheAsyncIT.cs index 1b0ac0cf8..e761a42ea 100644 --- a/Snowflake.Data.Tests/IntegrationTests/ConnectionSinglePoolCacheAsyncIT.cs +++ b/Snowflake.Data.Tests/IntegrationTests/ConnectionSinglePoolCacheAsyncIT.cs @@ -6,8 +6,8 @@ using NUnit.Framework; using Snowflake.Data.Client; using Snowflake.Data.Core.Session; -using Snowflake.Data.Tests.Mock; using Snowflake.Data.Tests.Util; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.IntegrationTests { diff --git a/Snowflake.Data.Tests/UnitTests/ConnectionCacheManagerTest.cs b/Snowflake.Data.Tests/UnitTests/ConnectionCacheManagerTest.cs index 589565ddf..12dcddd39 100644 --- a/Snowflake.Data.Tests/UnitTests/ConnectionCacheManagerTest.cs +++ b/Snowflake.Data.Tests/UnitTests/ConnectionCacheManagerTest.cs @@ -2,6 +2,7 @@ using Snowflake.Data.Client; using Snowflake.Data.Core.Session; using Snowflake.Data.Tests.Util; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.UnitTests { diff --git a/Snowflake.Data.Tests/UnitTests/ConnectionPoolManagerTest.cs b/Snowflake.Data.Tests/UnitTests/ConnectionPoolManagerTest.cs index 70efa47fb..a2a9374be 100644 --- a/Snowflake.Data.Tests/UnitTests/ConnectionPoolManagerTest.cs +++ b/Snowflake.Data.Tests/UnitTests/ConnectionPoolManagerTest.cs @@ -13,6 +13,7 @@ using Snowflake.Data.Client; using Snowflake.Data.Core.Tools; using Snowflake.Data.Tests.Util; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.UnitTests { diff --git a/Snowflake.Data.Tests/UnitTests/Session/ConnectionPoolConfigExtractorTest.cs b/Snowflake.Data.Tests/UnitTests/Session/ConnectionPoolConfigExtractorTest.cs index 0cc61f28b..6ee75d0d3 100644 --- a/Snowflake.Data.Tests/UnitTests/Session/ConnectionPoolConfigExtractorTest.cs +++ b/Snowflake.Data.Tests/UnitTests/Session/ConnectionPoolConfigExtractorTest.cs @@ -6,6 +6,7 @@ using Snowflake.Data.Core; using Snowflake.Data.Core.Session; using Snowflake.Data.Core.Tools; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.UnitTests.Session { diff --git a/Snowflake.Data.Tests/UnitTests/Session/FixedZeroCounterTest.cs b/Snowflake.Data.Tests/UnitTests/Session/FixedZeroCounterTest.cs index fd04be9af..518441484 100644 --- a/Snowflake.Data.Tests/UnitTests/Session/FixedZeroCounterTest.cs +++ b/Snowflake.Data.Tests/UnitTests/Session/FixedZeroCounterTest.cs @@ -1,5 +1,6 @@ using NUnit.Framework; using Snowflake.Data.Core.Session; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.UnitTests.Session { diff --git a/Snowflake.Data.Tests/UnitTests/Session/NonCountingSessionCreationTokenCounterTest.cs b/Snowflake.Data.Tests/UnitTests/Session/NonCountingSessionCreationTokenCounterTest.cs index 9f73c7c7a..6f4bb1b1f 100644 --- a/Snowflake.Data.Tests/UnitTests/Session/NonCountingSessionCreationTokenCounterTest.cs +++ b/Snowflake.Data.Tests/UnitTests/Session/NonCountingSessionCreationTokenCounterTest.cs @@ -1,6 +1,7 @@ using NUnit.Framework; using Snowflake.Data.Core; using Snowflake.Data.Core.Session; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.UnitTests.Session { @@ -12,28 +13,28 @@ public void TestGrantSessionCreation() { // arrange var tokens = new NonCountingSessionCreationTokenCounter(); - + // act tokens.NewToken(); - + // assert Assert.AreEqual(0, tokens.Count()); } - + [Test] public void TestCompleteSessionCreation() { // arrange var tokens = new NonCountingSessionCreationTokenCounter(); var token = tokens.NewToken(); - + // act tokens.RemoveToken(token); - + // assert Assert.AreEqual(0, tokens.Count()); } - + [Test] public void TestCompleteUnknownTokenDoesNotThrowExceptions() { @@ -41,7 +42,7 @@ public void TestCompleteUnknownTokenDoesNotThrowExceptions() var tokens = new NonCountingSessionCreationTokenCounter(); tokens.NewToken(); var unknownToken = new SessionCreationToken(SFSessionHttpClientProperties.DefaultConnectionTimeout); - + // act tokens.RemoveToken(unknownToken); diff --git a/Snowflake.Data.Tests/UnitTests/Session/NonNegativeCounterTest.cs b/Snowflake.Data.Tests/UnitTests/Session/NonNegativeCounterTest.cs index 638299532..33d060e13 100644 --- a/Snowflake.Data.Tests/UnitTests/Session/NonNegativeCounterTest.cs +++ b/Snowflake.Data.Tests/UnitTests/Session/NonNegativeCounterTest.cs @@ -1,5 +1,6 @@ using NUnit.Framework; using Snowflake.Data.Core.Session; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.UnitTests.Session { diff --git a/Snowflake.Data.Tests/UnitTests/Session/NonWaitingQueueTest.cs b/Snowflake.Data.Tests/UnitTests/Session/NonWaitingQueueTest.cs index 4d519b3a9..8cb6141b0 100644 --- a/Snowflake.Data.Tests/UnitTests/Session/NonWaitingQueueTest.cs +++ b/Snowflake.Data.Tests/UnitTests/Session/NonWaitingQueueTest.cs @@ -2,6 +2,7 @@ using System.Threading; using NUnit.Framework; using Snowflake.Data.Core.Session; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.UnitTests.Session { diff --git a/Snowflake.Data.Tests/UnitTests/Session/SessionCreationTokenCounterTest.cs b/Snowflake.Data.Tests/UnitTests/Session/SessionCreationTokenCounterTest.cs index ee825b44a..893af4222 100644 --- a/Snowflake.Data.Tests/UnitTests/Session/SessionCreationTokenCounterTest.cs +++ b/Snowflake.Data.Tests/UnitTests/Session/SessionCreationTokenCounterTest.cs @@ -3,6 +3,7 @@ using NUnit.Framework; using Snowflake.Data.Core; using Snowflake.Data.Core.Session; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.UnitTests.Session { diff --git a/Snowflake.Data.Tests/UnitTests/Session/SessionCreationTokenTest.cs b/Snowflake.Data.Tests/UnitTests/Session/SessionCreationTokenTest.cs index 13b45b9b1..248cde421 100644 --- a/Snowflake.Data.Tests/UnitTests/Session/SessionCreationTokenTest.cs +++ b/Snowflake.Data.Tests/UnitTests/Session/SessionCreationTokenTest.cs @@ -1,6 +1,7 @@ using System; using NUnit.Framework; using Snowflake.Data.Core.Session; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.UnitTests.Session { @@ -8,7 +9,7 @@ namespace Snowflake.Data.Tests.UnitTests.Session public class SessionCreationTokenTest { private static readonly TimeSpan s_timeout30Seconds = TimeSpan.FromSeconds(30); - + [Test] public void TestTokenIsNotExpired() { @@ -17,11 +18,11 @@ public void TestTokenIsNotExpired() // act var isExpired = token.IsExpired(DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()); - + // assert Assert.IsFalse(isExpired); } - + [Test] public void TestTokenIsExpired() { diff --git a/Snowflake.Data.Tests/UnitTests/Session/SessionOrCreationTokensTest.cs b/Snowflake.Data.Tests/UnitTests/Session/SessionOrCreationTokensTest.cs index 7d2b1a603..fe08dfcca 100644 --- a/Snowflake.Data.Tests/UnitTests/Session/SessionOrCreationTokensTest.cs +++ b/Snowflake.Data.Tests/UnitTests/Session/SessionOrCreationTokensTest.cs @@ -3,6 +3,7 @@ using NUnit.Framework; using Snowflake.Data.Core; using Snowflake.Data.Core.Session; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.UnitTests.Session { @@ -10,13 +11,13 @@ namespace Snowflake.Data.Tests.UnitTests.Session public class SessionOrCreationTokensTest { private SFSession _session = new SFSession("account=test;user=test;password=test", null); - + [Test] public void TestNoBackgroundSessionsToCreateWhenInitialisedWithSession() { // arrange var sessionOrTokens = new SessionOrCreationTokens(_session); - + // act var backgroundCreationTokens = sessionOrTokens.BackgroundSessionCreationTokens(); @@ -32,14 +33,14 @@ public void TestReturnFirstCreationToken() .Select(_ => sessionCreationTokenCounter.NewToken()) .ToList(); var sessionOrTokens = new SessionOrCreationTokens(tokens); - + // act var token = sessionOrTokens.SessionCreationToken(); - + // assert Assert.AreSame(tokens[0], token); } - + [Test] public void TestReturnCreationTokensFromTheSecondOneForBackgroundExecution() { @@ -49,10 +50,10 @@ public void TestReturnCreationTokensFromTheSecondOneForBackgroundExecution() .Select(_ => sessionCreationTokenCounter.NewToken()) .ToList(); var sessionOrTokens = new SessionOrCreationTokens(tokens); - + // act var backgroundTokens = sessionOrTokens.BackgroundSessionCreationTokens(); - + // assert Assert.AreEqual(2, backgroundTokens.Count); Assert.AreSame(tokens[1], backgroundTokens[0]); diff --git a/Snowflake.Data.Tests/UnitTests/Session/SessionPoolTest.cs b/Snowflake.Data.Tests/UnitTests/Session/SessionPoolTest.cs index fca8f7de1..adb439932 100644 --- a/Snowflake.Data.Tests/UnitTests/Session/SessionPoolTest.cs +++ b/Snowflake.Data.Tests/UnitTests/Session/SessionPoolTest.cs @@ -7,6 +7,7 @@ using Snowflake.Data.Core.Session; using Snowflake.Data.Core.Tools; using Snowflake.Data.Tests.Util; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.UnitTests.Session { diff --git a/Snowflake.Data.Tests/UnitTests/Session/SessionPropertiesWithDefaultValuesExtractorTest.cs b/Snowflake.Data.Tests/UnitTests/Session/SessionPropertiesWithDefaultValuesExtractorTest.cs index 3192c083e..1724e9585 100644 --- a/Snowflake.Data.Tests/UnitTests/Session/SessionPropertiesWithDefaultValuesExtractorTest.cs +++ b/Snowflake.Data.Tests/UnitTests/Session/SessionPropertiesWithDefaultValuesExtractorTest.cs @@ -2,6 +2,7 @@ using NUnit.Framework; using Snowflake.Data.Core; using Snowflake.Data.Core.Session; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.UnitTests.Session { diff --git a/Snowflake.Data.Tests/UnitTests/Session/WaitingQueueTest.cs b/Snowflake.Data.Tests/UnitTests/Session/WaitingQueueTest.cs index 530eae133..8cbfb7f62 100644 --- a/Snowflake.Data.Tests/UnitTests/Session/WaitingQueueTest.cs +++ b/Snowflake.Data.Tests/UnitTests/Session/WaitingQueueTest.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using NUnit.Framework; using Snowflake.Data.Core.Session; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.UnitTests.Session { diff --git a/Snowflake.Data.Tests/UnitTests/SnowflakeDbConnectionPoolTest.cs b/Snowflake.Data.Tests/UnitTests/SnowflakeDbConnectionPoolTest.cs index e2863f0b5..1ae589030 100644 --- a/Snowflake.Data.Tests/UnitTests/SnowflakeDbConnectionPoolTest.cs +++ b/Snowflake.Data.Tests/UnitTests/SnowflakeDbConnectionPoolTest.cs @@ -1,6 +1,7 @@ using NUnit.Framework; using Snowflake.Data.Client; using Snowflake.Data.Core.Session; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.UnitTests { diff --git a/Snowflake.Data.Tests/UnitTests/Tools/SecureStringHelperTest.cs b/Snowflake.Data.Tests/UnitTests/Tools/SecureStringHelperTest.cs index 52b10ed17..edaba0128 100644 --- a/Snowflake.Data.Tests/UnitTests/Tools/SecureStringHelperTest.cs +++ b/Snowflake.Data.Tests/UnitTests/Tools/SecureStringHelperTest.cs @@ -1,5 +1,6 @@ using NUnit.Framework; using Snowflake.Data.Core.Tools; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.UnitTests.Tools { diff --git a/Snowflake.Data.Tests/UnitTests/Tools/TimeoutHelperTest.cs b/Snowflake.Data.Tests/UnitTests/Tools/TimeoutHelperTest.cs index 8bda40b73..d17bc7c47 100644 --- a/Snowflake.Data.Tests/UnitTests/Tools/TimeoutHelperTest.cs +++ b/Snowflake.Data.Tests/UnitTests/Tools/TimeoutHelperTest.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using NUnit.Framework; using Snowflake.Data.Core.Tools; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.UnitTests.Tools { diff --git a/Snowflake.Data.Tests/Util/AwaiterTest.cs b/Snowflake.Data.Tests/Util/AwaiterTest.cs index a446f9c53..c2d83418f 100644 --- a/Snowflake.Data.Tests/Util/AwaiterTest.cs +++ b/Snowflake.Data.Tests/Util/AwaiterTest.cs @@ -1,5 +1,6 @@ using System; using NUnit.Framework; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Snowflake.Data.Tests.Util { @@ -7,13 +8,13 @@ namespace Snowflake.Data.Tests.Util public class AwaiterTest { private readonly TimeSpan _maxDurationRegardedAsImmediately = TimeSpan.FromSeconds(1); - + [Test] public void TestReturnsImmediatelyWhenConditionIsMet() { // act var millis = MillisecondsOfWaiting(() => true, TimeSpan.FromHours(1)); - + // assert Assert.LessOrEqual(millis, _maxDurationRegardedAsImmediately.TotalMilliseconds); } @@ -23,7 +24,7 @@ public void TestReturnsImmediatelyOnZeroTimeout() { // act var millis = MillisecondsOfWaiting(() => false, TimeSpan.FromMilliseconds(0)); - + // assert Assert.LessOrEqual(millis, _maxDurationRegardedAsImmediately.TotalMilliseconds); } @@ -33,10 +34,10 @@ public void TestReturnsOnTimeout() { // arrange var timeout = TimeSpan.FromSeconds(2); - + // act var millis = MillisecondsOfWaiting(() => false, TimeSpan.FromSeconds(2)); - + // assert Assert.GreaterOrEqual(millis, _maxDurationRegardedAsImmediately.TotalMilliseconds); Assert.LessOrEqual(millis, timeout.TotalMilliseconds + _maxDurationRegardedAsImmediately.TotalMilliseconds);