Skip to content

Commit

Permalink
remove CheckConnStrSetup attribute and replace with ConditionalFact (d…
Browse files Browse the repository at this point in the history
  • Loading branch information
Wraith2 authored and saurabh500 committed Dec 16, 2018
1 parent 2a5d5f4 commit 8dd81b8
Show file tree
Hide file tree
Showing 40 changed files with 159 additions and 183 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ namespace System.Data.SqlClient.ManualTesting.Tests
{
public static class DDAsyncTest
{
[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void OpenConnection_WithAsyncTrue_ThrowsNotSupportedException()
{
var asyncConnectionString = DataTestUtility.TcpConnStr + ";async=true";
Assert.Throws<NotSupportedException>(() => { new SqlConnection(asyncConnectionString); });
}

#region <<ExecuteCommand_WithNewConnection>>
[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void ExecuteCommand_WithNewConnection_ShouldPerformAsyncByDefault()
{
var executedProcessList = new List<string>();
Expand Down Expand Up @@ -63,7 +63,7 @@ private static async Task ExecuteCommandWithNewConnectionAsync(string processNam
#endregion

#region <<ExecuteCommand_WithSharedConnection>>
[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void ExecuteCommand_WithSharedConnection_ShouldPerformAsyncByDefault()
{
var executedProcessList = new List<string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace System.Data.SqlClient.ManualTesting.Tests
{
public static class DDDataTypesTest
{
[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void XmlTest()
{
string tempTable = "xml_" + Guid.NewGuid().ToString().Replace('-', '_');
Expand Down Expand Up @@ -71,7 +71,7 @@ public static void XmlTest()
}
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void MaxTypesTest()
{
string tempTable = "max_" + Guid.NewGuid().ToString().Replace('-', '_');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace System.Data.SqlClient.ManualTesting.Tests
{
public static class DDMARSTest
{
[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void TestMain()
{
string connstr = (new SqlConnectionStringBuilder(DataTestUtility.TcpConnStr) { MultipleActiveResultSets = true }).ConnectionString;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class MultipleResultsTest
private StringBuilder _outputBuilder;
private string[] _outputFilter;

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public void TestMain()
{
Assert.True(RunTestCoreAndCompareWithBaseline());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace System.Data.SqlClient.ManualTesting.Tests
{
public static class ReaderTest
{
[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void TestMain()
{
string connectionString = DataTestUtility.TcpConnStr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public AdapterTest()
InitDataValues();
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public void SimpleFillTest()
{
using (SqlConnection conn = new SqlConnection(DataTestUtility.TcpConnStr))
Expand All @@ -80,7 +80,7 @@ public void SimpleFillTest()
}
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public void PrepUnprepTest()
{
// share the connection
Expand Down Expand Up @@ -166,7 +166,7 @@ public void PrepUnprepTest()
}
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public void SqlVariantTest()
{
try
Expand Down Expand Up @@ -259,7 +259,7 @@ public void SqlVariantTest()
}
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public void ParameterTest_AllTypes()
{
string spCreateAllTypes =
Expand Down Expand Up @@ -470,7 +470,7 @@ public void ParameterTest_AllTypes()
}
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public void ParameterTest_InOut()
{
// input, output
Expand Down Expand Up @@ -566,7 +566,7 @@ public void ParameterTest_InOut()
}
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public void UpdateTest()
{
using (SqlConnection conn = new SqlConnection(DataTestUtility.TcpConnStr))
Expand Down Expand Up @@ -650,7 +650,7 @@ public void UpdateTest()

// these next texts verify that 'bulk' operations work. If each command type modifies more than three rows, then we do a Prep/Exec instead of
// adhoc ExecuteSql.
[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public void BulkUpdateTest()
{
using (SqlConnection conn = new SqlConnection(DataTestUtility.TcpConnStr))
Expand Down Expand Up @@ -747,7 +747,7 @@ public void BulkUpdateTest()

// Makes sure that we can refresh an identity column in the dataSet
// for a newly inserted row
[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public void UpdateRefreshTest()
{
string createIdentTable =
Expand Down Expand Up @@ -841,7 +841,7 @@ public void UpdateRefreshTest()
}
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public void UpdateNullTest()
{
string createTable = "CREATE TABLE varbin(cvarbin VARBINARY(7000), cimage IMAGE)";
Expand Down Expand Up @@ -895,7 +895,7 @@ public void UpdateNullTest()
}
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public void UpdateOffsetTest()
{
string createTable = "CREATE TABLE varbin(cvarbin VARBINARY(7000), cimage IMAGE)";
Expand Down Expand Up @@ -965,7 +965,7 @@ public void UpdateOffsetTest()
}
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public void SelectAllTest()
{
// Test exceptions
Expand All @@ -978,7 +978,7 @@ public void SelectAllTest()
}

// AutoGen test
[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public void AutoGenUpdateTest()
{
using (SqlConnection conn = new SqlConnection(DataTestUtility.TcpConnStr))
Expand Down Expand Up @@ -1049,7 +1049,7 @@ public void AutoGenUpdateTest()
}
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public void AutoGenErrorTest()
{
string createIdentTable =
Expand Down Expand Up @@ -1093,7 +1093,7 @@ public void AutoGenErrorTest()

// These next tests verify that 'bulk' operations work. If each command type modifies more than three rows, then we do a Prep/Exec instead of
// adhoc ExecuteSql.
[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public void AutoGenBulkUpdateTest()
{
using (SqlConnection conn = new SqlConnection(DataTestUtility.TcpConnStr))
Expand Down Expand Up @@ -1182,7 +1182,7 @@ public void AutoGenBulkUpdateTest()
}
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public void TestDeriveParameters()
{
string spEmployeeSales =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace System.Data.SqlClient.ManualTesting.Tests
{
public static class AsyncTest
{
[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void TestReadAsyncTimeConsumed()
{
const string sql = "SET NOCOUNT ON"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private static string GenerateCommandText()
return commandText;
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void ExecuteTest()
{
using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr))
Expand Down Expand Up @@ -67,7 +67,7 @@ public static void ExecuteTest()
}
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void FailureTest()
{
using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static class XmlReaderAsyncTest
private static string commandText =
"SELECT * from dbo.Customers FOR XML AUTO, XMLDATA;";

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void ExecuteTest()
{
using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr))
Expand All @@ -38,7 +38,7 @@ public static void ExecuteTest()
}
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void ExceptionTest()
{
using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ public static class CommandCancelTest
// Shrink the packet size - this should make timeouts more likely
private static readonly string s_connStr = (new SqlConnectionStringBuilder(DataTestUtility.TcpConnStr) { PacketSize = 512 }).ConnectionString;

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void PlainCancelTest()
{
PlainCancel(s_connStr);
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void PlainMARSCancelTest()
{
PlainCancel((new SqlConnectionStringBuilder(s_connStr) { MultipleActiveResultSets = true }).ConnectionString);
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void PlainCancelTestAsync()
{
PlainCancelAsync(s_connStr);
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void PlainMARSCancelTestAsync()
{
PlainCancelAsync((new SqlConnectionStringBuilder(s_connStr) { MultipleActiveResultSets = true }).ConnectionString);
Expand Down Expand Up @@ -87,31 +87,31 @@ private static void PlainCancelAsync(string connString)
}
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void MultiThreadedCancel_NonAsync()
{
MultiThreadedCancel(s_connStr, false);
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void MultiThreadedCancel_Async()
{
MultiThreadedCancel(s_connStr, true);
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void TimeoutCancel()
{
TimeoutCancel(s_connStr);
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void CancelAndDisposePreparedCommand()
{
CancelAndDisposePreparedCommand(s_connStr);
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void TimeOutDuringRead()
{
TimeOutDuringRead(s_connStr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public static class ConnectionPoolTest
private static readonly string _tcpConnStr = (new SqlConnectionStringBuilder(DataTestUtility.TcpConnStr) { MultipleActiveResultSets = false, Pooling = true }).ConnectionString;
private static readonly string _tcpMarsConnStr = (new SqlConnectionStringBuilder(DataTestUtility.TcpConnStr) { MultipleActiveResultSets = true, Pooling = true }).ConnectionString;

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void ConnectionPool_NonMars()
{
RunDataTestForSingleConnString(_tcpConnStr);
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void ConnectionPool_Mars()
{
RunDataTestForSingleConnString(_tcpMarsConnStr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static class ConnectivityParametersTest
private static readonly string s_selectTableCmd = $"SELECT COUNT(*) FROM {s_tableName}";
private static readonly string s_dropDatabaseCmd = $"DROP DATABASE {s_databaseName}";

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void EnvironmentHostNameTest()
{
SqlConnectionStringBuilder builder = (new SqlConnectionStringBuilder(DataTestUtility.TcpConnStr) { Pooling = true });
Expand Down Expand Up @@ -59,7 +59,7 @@ public static void EnvironmentHostNameTest()
Assert.True(false, "No non-empty hostname found for the application");
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void ConnectionTimeoutTestWithThread()
{
const int timeoutSec = 5;
Expand Down Expand Up @@ -93,7 +93,7 @@ public static void ConnectionTimeoutTestWithThread()
Assert.True(timeElapsed < threshold);
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void ProcessIdTest()
{
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(DataTestUtility.TcpConnStr);
Expand Down Expand Up @@ -180,7 +180,7 @@ public void SqlConnectionOpen()
}
}

[CheckConnStrSetupFact]
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup))]
public static void ConnectionKilledTest()
{
try
Expand Down
Loading

0 comments on commit 8dd81b8

Please sign in to comment.