Skip to content

Commit 5744b51

Browse files
authored
Code health - preprocessor directives (#2990)
1 parent 7ec6310 commit 5744b51

File tree

12 files changed

+23
-23
lines changed

12 files changed

+23
-23
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3169,7 +3169,7 @@ public Customer(int id, string firstName, string lastName)
31693169
public string LastName { get; set; }
31703170
}
31713171

3172-
#if NET6_0_OR_GREATER
3172+
#if !NETFRAMEWORK
31733173
public record CustomerDateOnly(int Id, string FirstName, string LastName, DateOnly DateOfBirth, TimeOnly TimeOfDay);
31743174
#endif
31753175

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using Xunit;
1010
using System.Collections.Generic;
1111
using static Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted.CertificateUtilityWin;
12-
#if NET6_0_OR_GREATER
12+
#if !NETFRAMEWORK
1313
using System.Runtime.Versioning;
1414
#endif
1515

@@ -19,7 +19,7 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted
1919
/// Always Encrypted public CspProvider Manual tests.
2020
/// 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.
2121
/// </summary>
22-
#if NET6_0_OR_GREATER
22+
#if !NETFRAMEWORK
2323
[SupportedOSPlatform("windows")]
2424
#endif
2525
[PlatformSpecific(TestPlatforms.Windows)]

src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/DatabaseHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ internal static void InsertCustomerData(SqlConnection sqlConnection, SqlTransact
3131
sqlCommand.ExecuteNonQuery();
3232
}
3333

34-
#if NET6_0_OR_GREATER
34+
#if !NETFRAMEWORK
3535
/// <summary>
3636
/// Insert CustomerDateOnly record into table
3737
/// </summary>
@@ -176,7 +176,7 @@ public static void CompareResults(SqlDataReader sqlDataReader, string[] paramete
176176
case "int":
177177
Assert.True(sqlDataReader.GetInt32(columnsRead) == 45, "FAILED: read int value does not match.");
178178
break;
179-
#if NET6_0_OR_GREATER
179+
#if !NETFRAMEWORK
180180
case "DateOnly":
181181
Assert.True(sqlDataReader.GetFieldValue<DateOnly>(columnsRead) == new DateOnly(2001, 1, 31), "FAILED: read DateOnly value does not match.");
182182
break;

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
@@ -9,13 +9,13 @@
99
using Xunit;
1010
using System.Collections.Generic;
1111
using static System.Net.Mime.MediaTypeNames;
12-
#if NET6_0_OR_GREATER
12+
#if !NETFRAMEWORK
1313
using System.Runtime.Versioning;
1414
#endif
1515

1616
namespace Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted
1717
{
18-
#if NET6_0_OR_GREATER
18+
#if !NETFRAMEWORK
1919
[SupportedOSPlatform("windows")]
2020
#endif
2121
[PlatformSpecific(TestPlatforms.Windows)]

src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public static bool IsAdmin
359359
{
360360
get
361361
{
362-
#if NET6_0_OR_GREATER
362+
#if !NETFRAMEWORK
363363
System.Diagnostics.Debug.Assert(OperatingSystem.IsWindows());
364364
#endif
365365
return new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);
@@ -472,7 +472,7 @@ public static TokenCredential GetTokenCredential()
472472
public static bool IsTargetReadyForAeWithKeyStore()
473473
{
474474
return DataTestUtility.AreConnStringSetupForAE()
475-
#if NET6_0_OR_GREATER
475+
#if !NETFRAMEWORK
476476
// AE tests on Windows will use the Cert Store. On non-Windows, they require AKV.
477477
&& (OperatingSystem.IsWindows() || DataTestUtility.IsAKVSetupAvailable())
478478
#endif
@@ -495,7 +495,7 @@ public static bool IsSupportingDistributedTransactions()
495495
public static bool IsNotUsingManagedSNIOnWindows() => !UseManagedSNIOnWindows;
496496

497497
public static bool IsUsingNativeSNI() =>
498-
#if NET6_0_OR_GREATER
498+
#if !NETFRAMEWORK
499499
IsNotUsingManagedSNIOnWindows();
500500
#else
501501
true;

src/Microsoft.Data.SqlClient/tests/ManualTests/ProviderAgnostic/ReaderTest/ReaderTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ public static void SqlDataReader_SqlBuffer_GetFieldValue()
348348
Assert.Equal(dtoffset, reader.GetFieldValue<DateTimeOffset>(11));
349349
Assert.Equal(new DateTime(2022, 10, 23), reader.GetFieldValue<DateTime>(12));
350350
Assert.Equal(new TimeSpan(0, 22, 7, 44), reader.GetFieldValue<TimeSpan>(13));
351-
#if NET6_0_OR_GREATER
351+
#if !NETFRAMEWORK
352352
Assert.Equal(new DateOnly(2022, 10, 23), reader.GetFieldValue<DateOnly>(12));
353353
Assert.Equal(new TimeOnly(22, 7, 44), reader.GetFieldValue<TimeOnly>(13));
354354
#endif
@@ -367,7 +367,7 @@ public static void SqlDataReader_SqlBuffer_GetFieldValue()
367367
}
368368
}
369369

370-
#if NET6_0_OR_GREATER
370+
#if !NETFRAMEWORK
371371
/// <summary>
372372
/// Covers GetFieldValue<T> for SqlBuffer class
373373
/// </summary>

src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderStreamsTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ public static void InvalidCastExceptionStream(CommandBehavior behavior, Accessor
472472
}
473473
}
474474

475-
#if NET6_0_OR_GREATER
475+
#if !NETFRAMEWORK
476476
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
477477
public static async Task ReadAsyncContentsCompletes()
478478
{

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public static void ReaderParameterTest()
212212
Assert.True(IsValidParam(SqlDbType.Date, "c1", new DateTime(1753, 1, 1, 0, 0, 0, DateTimeKind.Local), conn, tableName), "FAILED: Invalid param for Date SqlDbType");
213213
Assert.False(IsValidParam(SqlDbType.Date, "c1", new TimeSpan(), conn, tableName), "FAILED: Invalid param for Date SqlDbType");
214214
Assert.True(IsValidParam(SqlDbType.Date, "c1", "1753-1-1", conn, tableName), "FAILED: Invalid param for Date SqlDbType");
215-
#if NET6_0_OR_GREATER
215+
#if !NETFRAMEWORK
216216
Assert.True(IsValidParam(SqlDbType.Date, "c1", new DateOnly(1753, 1, 1), conn, tableName), "FAILED: Invalid param for Date SqlDbType");
217217
Assert.False(IsValidParam(SqlDbType.Date, "c1", new TimeOnly(), conn, tableName), "FAILED: Invalid param for Date SqlDbType");
218218
#endif
@@ -225,7 +225,7 @@ public static void ReaderParameterTest()
225225
Assert.False(IsValidParam(SqlDbType.Time, "c2", new DateTime(1753, 1, 1, 0, 0, 0, DateTimeKind.Local), conn, tableName), "FAILED: Invalid param for Time SqlDbType");
226226
Assert.True(IsValidParam(SqlDbType.Time, "c2", TimeSpan.Parse("20:12:13.36"), conn, tableName), "FAILED: Invalid param for Time SqlDbType");
227227
Assert.True(IsValidParam(SqlDbType.Time, "c2", "20:12:13.36", conn, tableName), "FAILED: Invalid param for Time SqlDbType");
228-
#if NET6_0_OR_GREATER
228+
#if !NETFRAMEWORK
229229
Assert.False(IsValidParam(SqlDbType.Time, "c2", new DateOnly(1753, 1, 1), conn, tableName), "FAILED: Invalid param for Time SqlDbType");
230230
Assert.True(IsValidParam(SqlDbType.Time, "c2", new TimeOnly(20, 12, 13, 360), conn, tableName), "FAILED: Invalid param for Time SqlDbType");
231231
#endif
@@ -382,7 +382,7 @@ public static void ReaderParameterTest()
382382
Assert.True(IsValidParam(DbType.Date, "c1", new DateTime(1753, 1, 1, 0, 0, 0, DateTimeKind.Local), conn, tableName), "FAILED: Invalid param for Date DbType");
383383
Assert.False(IsValidParam(DbType.Date, "c1", new TimeSpan(), conn, tableName), "FAILED: Invalid param for Date DbType");
384384
Assert.True(IsValidParam(DbType.Date, "c1", "1753-1-1", conn, tableName), "FAILED: Invalid param for Date DbType");
385-
#if NET6_0_OR_GREATER
385+
#if !NETFRAMEWORK
386386
Assert.True(IsValidParam(DbType.Date, "c1", new DateOnly(1753, 1, 1), conn, tableName), "FAILED: Invalid param for Date DbType");
387387
Assert.False(IsValidParam(DbType.Date, "c1", new TimeOnly(), conn, tableName), "FAILED: Invalid param for Date DbType");
388388
#endif
@@ -396,7 +396,7 @@ public static void ReaderParameterTest()
396396
Assert.False(IsValidParam(DbType.Time, "c2", new DateTime(1753, 1, 1, 0, 0, 0, DateTimeKind.Local), conn, tableName), "FAILED: Invalid param for Time DbType");
397397
Assert.True(IsValidParam(DbType.Time, "c2", TimeSpan.Parse("20:12:13.36"), conn, tableName), "FAILED: Invalid param for Time DbType");
398398
Assert.True(IsValidParam(DbType.Time, "c2", "20:12:13.36", conn, tableName), "FAILED: Invalid param for Time DbType");
399-
#if NET6_0_OR_GREATER
399+
#if !NETFRAMEWORK
400400
Assert.False(IsValidParam(DbType.Time, "c2", new DateOnly(1753, 1, 1), conn, tableName), "FAILED: Invalid param for Time DbType");
401401
Assert.True(IsValidParam(DbType.Time, "c2", new TimeOnly(20, 12, 13, 360), conn, tableName), "FAILED: Invalid param for Time DbType");
402402
#endif
@@ -520,7 +520,7 @@ public static void ReaderParameterTest()
520520
}
521521
}
522522

523-
#if NET6_0_OR_GREATER
523+
#if !NETFRAMEWORK
524524
// Synapse: CREATE or ALTER PROCEDURE statement uses syntax or features that are not supported in SQL Server PDW.
525525
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
526526
public static void ReaderParameterTest_DateOnly_TimeOnly()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static void ConnectManagedWithInstanceNameTest(bool useMultiSubnetFailove
8787
}
8888
}
8989

90-
#if NET6_0_OR_GREATER
90+
#if !NETFRAMEWORK
9191
[ConditionalFact(nameof(IsSPNPortNumberTestForTCP))]
9292
public static void SPNTestForTCPMustReturnPortNumber()
9393
{

src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/ParametersTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using System.Data.SqlTypes;
1010
using System.Threading;
1111
using Xunit;
12-
#if NET6_0_OR_GREATER
12+
#if !NETFRAMEWORK
1313
using Microsoft.SqlServer.Types;
1414
using Microsoft.Data.SqlClient.Server;
1515
#endif
@@ -310,7 +310,7 @@ public static void TestParametersWithDatatablesTVPInsert()
310310
}
311311
}
312312

313-
#if NET6_0_OR_GREATER
313+
#if !NETFRAMEWORK
314314
// Synapse: Parse error at line: 1, column: 8: Incorrect syntax near 'TYPE'.
315315
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
316316
public static void TestParametersWithSqlRecordsTVPInsert()

0 commit comments

Comments
 (0)