Skip to content

Commit 708cf3a

Browse files
author
Javad
authored
Test | Removing all net5 references from the driver (#1823)
1 parent 146c34e commit 708cf3a

File tree

10 files changed

+16
-16
lines changed

10 files changed

+16
-16
lines changed

src/Microsoft.Data.SqlClient/src/System/Diagnostics/CodeAnalysis.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ internal sealed class NotNullWhenAttribute : Attribute
5959
}
6060
#endif
6161

62-
#if !NET5_0_OR_GREATER
62+
#if !NET6_0_OR_GREATER
6363
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = true, Inherited = false)]
6464
internal sealed class MemberNotNullAttribute : Attribute
6565
{

src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCertificateStoreProviderShould.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ public static bool IsAdmin
634634
{
635635
get
636636
{
637-
#if NET5_0_OR_GREATER
637+
#if NET6_0_OR_GREATER
638638
System.Diagnostics.Debug.Assert(OperatingSystem.IsWindows());
639639
#endif
640640
return new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);

src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCngProviderShould.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public void Dispose()
182182

183183
public static void AddKeyToCng(string providerName, string containerName)
184184
{
185-
#if NET5_0_OR_GREATER
185+
#if NET6_0_OR_GREATER
186186
System.Diagnostics.Debug.Assert(OperatingSystem.IsWindows());
187187
#endif
188188
CngKeyCreationParameters keyParams = new CngKeyCreationParameters();
@@ -202,7 +202,7 @@ public static void AddKeyToCng(string providerName, string containerName)
202202

203203
public static void RemoveKeyFromCng(string providerName, string containerName)
204204
{
205-
#if NET5_0_OR_GREATER
205+
#if NET6_0_OR_GREATER
206206
System.Diagnostics.Debug.Assert(OperatingSystem.IsWindows());
207207
#endif
208208
CngProvider cngProvider = new CngProvider(providerName);

src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCspProviderShould.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public void Dispose()
183183

184184
public static void AddKeyToCsp(string containerName)
185185
{
186-
#if NET5_0_OR_GREATER
186+
#if NET6_0_OR_GREATER
187187
System.Diagnostics.Debug.Assert(OperatingSystem.IsWindows());
188188
#endif
189189
CspParameters cspParams = new();
@@ -194,7 +194,7 @@ public static void AddKeyToCsp(string containerName)
194194

195195
public static void RemoveKeyFromCsp(string containerName)
196196
{
197-
#if NET5_0_OR_GREATER
197+
#if NET6_0_OR_GREATER
198198
System.Diagnostics.Debug.Assert(OperatingSystem.IsWindows());
199199
#endif
200200
CspParameters cspParams = new CspParameters();

src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<RuntimeIdentifier Condition="'$(TargetGroup)'=='netfx'">win</RuntimeIdentifier>
88
<DefineConstants Condition="'$(TargetGroup)'=='netfx'">$(DefineConstants);NETFRAMEWORK</DefineConstants>
99
<DefineConstants Condition="'$(TargetGroup)'=='netcoreapp'">$(DefineConstants);NETCOREAPP</DefineConstants>
10-
<DefineConstants Condition="'$(TargetGroup)' == 'netcoreapp' AND !$(TargetFramework.StartsWith('netcoreapp'))">$(DefineConstants);NET50_OR_LATER</DefineConstants>
1110
<DefineConstants Condition="$(ReferenceType.Contains('NetStandard'))">NETSTANDARDREFERNCE</DefineConstants>
1211
<IntermediateOutputPath>$(ObjFolder)$(Configuration).$(Platform).$(AssemblyName)</IntermediateOutputPath>
1312
<OutputPath>$(BinFolder)$(Configuration).$(Platform).$(AssemblyName)</OutputPath>

src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/CspProviderExt.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using System.Security.Cryptography.X509Certificates;
88
using Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted.Setup;
99
using Xunit;
10-
#if NET50_OR_LATER
10+
#if NET6_0_OR_GREATER
1111
using System.Runtime.Versioning;
1212
#endif
1313

@@ -17,7 +17,7 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted
1717
/// Always Encrypted public CspProvider Manual tests.
1818
/// TODO: These tests are marked as Windows only for now but should be run for all platforms once the Master Key is accessible to this app from Azure Key Vault.
1919
/// </summary>
20-
#if NET50_OR_LATER
20+
#if NET6_0_OR_GREATER
2121
[SupportedOSPlatform("windows")]
2222
#endif
2323
[PlatformSpecific(TestPlatforms.Windows)]

src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtilityWin.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
using System.Security.Cryptography;
88
using System.Security.Cryptography.X509Certificates;
99
using Xunit;
10-
#if NET50_OR_LATER
10+
#if NET6_0_OR_GREATER
1111
using System.Runtime.Versioning;
1212
#endif
1313

1414
namespace Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted
1515
{
16-
#if NET50_OR_LATER
16+
#if NET6_0_OR_GREATER
1717
[SupportedOSPlatform("windows")]
1818
#endif
1919
[PlatformSpecific(TestPlatforms.Windows)]

src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,13 +1556,14 @@ private static void ReadStream(string connectionString)
15561556
DataTestUtility.AssertThrowsWrapper<ArgumentOutOfRangeException>(() => stream.Read(buffer, -1, 2));
15571557
DataTestUtility.AssertThrowsWrapper<ArgumentOutOfRangeException>(() => stream.Read(buffer, 2, -1));
15581558

1559-
// ArgumentException is thrown in net5 and earlier. ArgumentOutOfRangeException in net6 and later
1559+
// Prior to net6 comment:ArgumentException is thrown in net5 and earlier. ArgumentOutOfRangeException in net6 and later
1560+
// After adding net6: Running tests against netstandard2.1 still showing ArgumentException, but the rest works fine.
15601561
ArgumentException ex = Assert.ThrowsAny<ArgumentException>(() => stream.Read(buffer, buffer.Length, buffer.Length));
15611562
Assert.True(ex.GetType() == typeof(ArgumentException) || ex.GetType() == typeof(ArgumentOutOfRangeException),
1562-
"Expected: ArgumentException in net5 and earlier. ArgumentOutOfRangeException in net6 and later.");
1563+
"Expected: ArgumentException in net5 and earlier. ArgumentOutOfRangeException in net6 and later.");
15631564
ex = Assert.ThrowsAny<ArgumentException>(() => stream.Read(buffer, int.MaxValue, int.MaxValue));
15641565
Assert.True(ex.GetType() == typeof(ArgumentException) || ex.GetType() == typeof(ArgumentOutOfRangeException),
1565-
"Expected: ArgumentException in net5 and earlier. ArgumentOutOfRangeException in net6 and later.");
1566+
"Expected: ArgumentException in net5 and earlier. ArgumentOutOfRangeException in net6 and later.");
15661567
}
15671568

15681569
// Once Reader is closed

src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlDSEnumeratorTest/SqlDataSourceEnumeratorTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace Microsoft.Data.SqlClient.ManualTesting.Tests
1212
{
13-
#if NET50_OR_LATER
13+
#if NET6_0_OR_GREATER
1414
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
1515
#endif
1616
public class SqlDataSourceEnumeratorTest

src/Microsoft.Data.SqlClient/tests/PerformanceTests/Microsoft.Data.SqlClient.PerformanceTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
44
<AssemblyName>PerformanceTests</AssemblyName>
5-
<TargetFrameworks>net6.0;net5.0</TargetFrameworks>
5+
<TargetFrameworks>net6.0</TargetFrameworks>
66
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
77
<Configurations>Debug;Release;</Configurations>
88
<IntermediateOutputPath>$(ObjFolder)$(Configuration).$(Platform).$(AssemblyName)</IntermediateOutputPath>

0 commit comments

Comments
 (0)