Skip to content

Commit babef3b

Browse files
committed
Fix whitespace and indentation formatting errors.
1 parent 43a25e0 commit babef3b

21 files changed

+218
-215
lines changed

src/MySqlConnector/Core/MetricsReporter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static IEnumerable<Measurement<int>> GetMinimumConnections() =>
5050
private static readonly UpDownCounter<int> s_pendingRequestsCounter = ActivitySourceHelper.Meter.CreateUpDownCounter<int>("db.client.connections.pending_requests",
5151
unit: "{request}", description: "The number of pending requests for an open connection, cumulative for the entire pool.");
5252
private static readonly Counter<int> s_connectionTimeouts = ActivitySourceHelper.Meter.CreateCounter<int>("db.client.connections.timeouts",
53-
unit: "{timeout}", description: "The number of connection timeouts that have occurred trying to obtain a connection from the pool.");
53+
unit: "{timeout}", description: "The number of connection timeouts that have occurred trying to obtain a connection from the pool.");
5454
private static readonly Histogram<double> s_createTimeHistory = ActivitySourceHelper.Meter.CreateHistogram<double>("db.client.connections.create_time",
5555
unit: "s", description: "The time it took to create a new connection.");
5656
private static readonly Histogram<double> s_useTimeHistory = ActivitySourceHelper.Meter.CreateHistogram<double>("db.client.connections.use_time",

src/MySqlConnector/Protocol/Serialization/ByteArrayReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public int Offset
2323
if (value < 0 || value > m_maxOffset)
2424
throw new ArgumentOutOfRangeException(nameof(value), $"value must be between 0 and {m_maxOffset:d}");
2525
#endif
26-
m_offset = value;
26+
m_offset = value;
2727
}
2828
}
2929

tests/Conformance.Tests/DbFactoryFixture.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
namespace Conformance.Tests;
77

88
public class DbFactoryFixture : IDbFactoryFixture
9+
{
10+
public DbFactoryFixture()
911
{
10-
public DbFactoryFixture()
11-
{
12-
ConnectionString = Environment.GetEnvironmentVariable("CONNECTION_STRING") ?? "Server=localhost;User Id=mysqltest;Password=test;SSL Mode=None;AllowPublicKeyRetrieval=true";
13-
}
14-
15-
public string ConnectionString { get; }
16-
public DbProviderFactory Factory => MySqlConnectorFactory.Instance;
12+
ConnectionString = Environment.GetEnvironmentVariable("CONNECTION_STRING") ?? "Server=localhost;User Id=mysqltest;Password=test;SSL Mode=None;AllowPublicKeyRetrieval=true";
1713
}
14+
15+
public string ConnectionString { get; }
16+
public DbProviderFactory Factory => MySqlConnectorFactory.Instance;
17+
}

tests/IntegrationTests/BulkLoaderSync.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,34 +1243,34 @@ public void BulkCopyDataTableConflictOption(MySqlBulkLoaderConflictOption confli
12431243

12441244
switch (conflictOption)
12451245
{
1246-
case MySqlBulkLoaderConflictOption.None:
1247-
var exception = Assert.Throws<MySqlException>(() => bulkCopy.WriteToServer(dataTable));
1248-
Assert.Equal(MySqlErrorCode.BulkCopyFailed, exception.ErrorCode);
1249-
break;
1250-
1251-
case MySqlBulkLoaderConflictOption.Replace:
1252-
var replaceResult = bulkCopy.WriteToServer(dataTable);
1253-
Assert.Equal(expectedRowsInserted, replaceResult.RowsInserted);
1254-
Assert.Empty(replaceResult.Warnings);
1255-
break;
1256-
1257-
case MySqlBulkLoaderConflictOption.Ignore:
1258-
var ignoreResult = bulkCopy.WriteToServer(dataTable);
1259-
Assert.Equal(expectedRowsInserted, ignoreResult.RowsInserted);
1260-
if (!connection.ServerVersion.StartsWith("5.6.", StringComparison.Ordinal))
1261-
{
1262-
var error = Assert.Single(ignoreResult.Warnings);
1263-
Assert.Equal(MySqlErrorCode.DuplicateKeyEntry, error.ErrorCode);
1264-
}
1265-
break;
1246+
case MySqlBulkLoaderConflictOption.None:
1247+
var exception = Assert.Throws<MySqlException>(() => bulkCopy.WriteToServer(dataTable));
1248+
Assert.Equal(MySqlErrorCode.BulkCopyFailed, exception.ErrorCode);
1249+
break;
1250+
1251+
case MySqlBulkLoaderConflictOption.Replace:
1252+
var replaceResult = bulkCopy.WriteToServer(dataTable);
1253+
Assert.Equal(expectedRowsInserted, replaceResult.RowsInserted);
1254+
Assert.Empty(replaceResult.Warnings);
1255+
break;
1256+
1257+
case MySqlBulkLoaderConflictOption.Ignore:
1258+
var ignoreResult = bulkCopy.WriteToServer(dataTable);
1259+
Assert.Equal(expectedRowsInserted, ignoreResult.RowsInserted);
1260+
if (!connection.ServerVersion.StartsWith("5.6.", StringComparison.Ordinal))
1261+
{
1262+
var error = Assert.Single(ignoreResult.Warnings);
1263+
Assert.Equal(MySqlErrorCode.DuplicateKeyEntry, error.ErrorCode);
1264+
}
1265+
break;
12661266
}
12671267

12681268
using (var cmd = new MySqlCommand("select b from bulk_load_data_table;", connection))
12691269
Assert.Equal(expected, cmd.ExecuteScalar());
12701270
}
12711271
#endif
12721272

1273-
internal static string GetConnectionString() => AppConfig.ConnectionString;
1273+
internal static string GetConnectionString() => AppConfig.ConnectionString;
12741274

12751275
internal static string GetLocalConnectionString()
12761276
{

tests/IntegrationTests/CommandTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public void ExecuteNonQueryForSelectReturnsNegativeOne()
226226
Assert.Equal(-1, command.ExecuteNonQuery());
227227
}
228228

229-
[Fact]
229+
[Fact]
230230
public async Task ExecuteNonQueryReturnValue()
231231
{
232232
using var connection = new MySqlConnection(m_database.Connection.ConnectionString);

tests/IntegrationTests/DataTypes.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,19 @@ private async Task DoGetValue<T>(string column, Func<MySqlDataReader, int, T> ge
155155
Assert.True(await reader.ReadAsync().ConfigureAwait(false));
156156
switch (flags[i])
157157
{
158-
case 0: // normal
159-
Assert.Equal(values[i], getInt(reader, 0));
160-
Assert.Equal(values[i], getIntByName(reader, column));
161-
break;
162-
163-
case 1: // null
164-
Assert.True(await reader.IsDBNullAsync(0).ConfigureAwait(false));
165-
break;
166-
167-
case 2: // overflow
168-
Assert.Throws<OverflowException>(() => getInt(reader, 0));
169-
Assert.Throws<OverflowException>(() => getIntByName(reader, column));
170-
break;
158+
case 0: // normal
159+
Assert.Equal(values[i], getInt(reader, 0));
160+
Assert.Equal(values[i], getIntByName(reader, column));
161+
break;
162+
163+
case 1: // null
164+
Assert.True(await reader.IsDBNullAsync(0).ConfigureAwait(false));
165+
break;
166+
167+
case 2: // overflow
168+
Assert.Throws<OverflowException>(() => getInt(reader, 0));
169+
Assert.Throws<OverflowException>(() => getIntByName(reader, column));
170+
break;
171171
}
172172
}
173173
Assert.False(await reader.ReadAsync().ConfigureAwait(false));

tests/IntegrationTests/InsertTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ value mediumblob null
778778
cmd.Prepare();
779779
cmd.ExecuteNonQuery();
780780
}
781-
Assert.Equal(new byte[] { 1, 0, 2, 39, 3, 92, 4, 34, 5, 6 }, connection.Query<byte[]>(@"select value from insert_mysql_blob;").Single());
781+
Assert.Equal(new byte[] { 1, 0, 2, 39, 3, 92, 4, 34, 5, 6 }, connection.Query<byte[]>(@"select value from insert_mysql_blob;").Single());
782782
}
783783

784784
public static IEnumerable<object[]> GetBlobs()

tests/IntegrationTests/LoadDataInfileAsync.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public async Task CommandLoadCsvFile()
3030
{
3131
var insertInlineCommand = string.Format(m_loadDataInfileCommand, "", AppConfig.MySqlBulkLoaderCsvFile.Replace("\\", "\\\\"));
3232
using var command = new MySqlCommand(insertInlineCommand, m_database.Connection);
33-
if (m_database.Connection.State != ConnectionState.Open) await m_database.Connection.OpenAsync();
33+
if (m_database.Connection.State != ConnectionState.Open)
34+
await m_database.Connection.OpenAsync();
3435
var rowCount = await command.ExecuteNonQueryAsync();
3536
m_database.Connection.Close();
3637
Assert.Equal(20, rowCount);

tests/IntegrationTests/LoadDataInfileSync.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public void CommandLoadCsvFile()
3030
{
3131
var insertInlineCommand = string.Format(m_loadDataInfileCommand, "", AppConfig.MySqlBulkLoaderCsvFile.Replace("\\", "\\\\"));
3232
using var command = new MySqlCommand(insertInlineCommand, m_database.Connection);
33-
if (m_database.Connection.State != ConnectionState.Open) m_database.Connection.Open();
33+
if (m_database.Connection.State != ConnectionState.Open)
34+
m_database.Connection.Open();
3435
var rowCount = command.ExecuteNonQuery();
3536
m_database.Connection.Close();
3637
Assert.Equal(20, rowCount);
@@ -41,7 +42,8 @@ public void CommandLoadLocalCsvFile()
4142
{
4243
var insertInlineCommand = string.Format(m_loadDataInfileCommand, " LOCAL", AppConfig.MySqlBulkLoaderLocalCsvFile.Replace("\\", "\\\\"));
4344
using var command = new MySqlCommand(insertInlineCommand, m_database.Connection);
44-
if (m_database.Connection.State != ConnectionState.Open) m_database.Connection.Open();
45+
if (m_database.Connection.State != ConnectionState.Open)
46+
m_database.Connection.Open();
4547
var rowCount = command.ExecuteNonQuery();
4648
m_database.Connection.Close();
4749
Assert.Equal(20, rowCount);

tests/IntegrationTests/MySqlDataSourceTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ public void OpenConnection()
2525
Assert.Equal(ConnectionState.Open, connection.State);
2626
}
2727

28-
[Fact]
29-
public void DoubleDispose()
30-
{
31-
using var dbSource = new MySqlDataSource(AppConfig.ConnectionString);
28+
[Fact]
29+
public void DoubleDispose()
30+
{
31+
using var dbSource = new MySqlDataSource(AppConfig.ConnectionString);
3232
using (var connection = dbSource.OpenConnection())
3333
{
34-
Assert.Equal(ConnectionState.Open, connection.State);
35-
}
34+
Assert.Equal(ConnectionState.Open, connection.State);
35+
}
3636
dbSource.Dispose();
37-
}
38-
37+
}
38+
3939
[Fact]
4040
public async Task OpenConnectionAsync()
4141
{
@@ -224,7 +224,7 @@ public void PasswordProviderFailureIsRetried()
224224
var exception = Assert.Throws<MySqlException>(dataSource.OpenConnection); // Failed to obtain password via ProvidePasswordCallback
225225
Assert.IsType<MySqlException>(exception.InnerException); // The periodic password provider failed
226226
Assert.IsType<ApplicationException>(exception.InnerException.InnerException); // First-time failure
227-
227+
228228
// succeeds after failure retry
229229
barrier.SignalAndWait();
230230
Thread.Sleep(10);

tests/IntegrationTests/PreparedCommandTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ private enum TwoByteEnum : short
488488
{
489489
Value = 111,
490490
}
491-
491+
492492

493493
private static MySqlConnection CreateConnection()
494494
{

tests/IntegrationTests/SchemaProviderTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,12 @@ public void GetCollationsSchema()
183183

184184
[Fact]
185185
public void ForeignKeys()
186-
{
187-
var schemaName = m_database.Connection.Database;
188-
var table = m_database.Connection.GetSchema("Foreign Keys", new[] { null, schemaName, "fk_test" });
189-
var row = table.Rows.Cast<DataRow>().Single();
190-
foreach (var (column, value) in new[]
191-
{
186+
{
187+
var schemaName = m_database.Connection.Database;
188+
var table = m_database.Connection.GetSchema("Foreign Keys", new[] { null, schemaName, "fk_test" });
189+
var row = table.Rows.Cast<DataRow>().Single();
190+
foreach (var (column, value) in new[]
191+
{
192192
("CONSTRAINT_CATALOG", "def"),
193193
("CONSTRAINT_SCHEMA", schemaName),
194194
("CONSTRAINT_NAME", "fk_test_fk"),
@@ -200,10 +200,10 @@ public void ForeignKeys()
200200
("REFERENCED_TABLE_SCHEMA", schemaName),
201201
("REFERENCED_TABLE_NAME", "pk_test"),
202202
})
203-
{
203+
{
204204
Assert.Equal(value, row[column] is DBNull ? null : (string?) row[column]);
205-
}
206-
}
205+
}
206+
}
207207

208208
[Fact]
209209
public void Indexes()

tests/IntegrationTests/StoredProcedureTests.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -443,18 +443,18 @@ private async Task<object> ExecuteCommandAsync(DbCommand cmd, string executorTyp
443443
{
444444
switch (executorType)
445445
{
446-
case "NonQuery":
447-
await cmd.ExecuteNonQueryAsync();
448-
return null;
449-
case "Scalar":
450-
return await cmd.ExecuteScalarAsync();
451-
default:
452-
using (var reader = await cmd.ExecuteReaderAsync())
453-
{
454-
if (await reader.ReadAsync())
455-
return reader.GetValue(0);
446+
case "NonQuery":
447+
await cmd.ExecuteNonQueryAsync();
456448
return null;
457-
}
449+
case "Scalar":
450+
return await cmd.ExecuteScalarAsync();
451+
default:
452+
using (var reader = await cmd.ExecuteReaderAsync())
453+
{
454+
if (await reader.ReadAsync())
455+
return reader.GetValue(0);
456+
return null;
457+
}
458458
}
459459
}
460460

tests/IntegrationTests/TestUtilities.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ public static void AssertIsOne(object value)
2424
{
2525
switch (value)
2626
{
27-
case int intValue:
28-
Assert.Equal(1, intValue);
29-
break;
27+
case int intValue:
28+
Assert.Equal(1, intValue);
29+
break;
3030

31-
case long longValue:
32-
Assert.Equal(1L, longValue);
33-
break;
31+
case long longValue:
32+
Assert.Equal(1L, longValue);
33+
break;
3434

35-
default:
36-
Assert.Equal(1L, value);
37-
break;
35+
default:
36+
Assert.Equal(1L, value);
37+
break;
3838
}
3939
}
4040

tests/IntegrationTests/Transaction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ public void TransactionHoldsLocks()
399399
""";
400400
command.ExecuteNonQuery();
401401
}
402-
402+
403403
using var barrier = new Barrier(2);
404404
using var barrier2 = new Barrier(2);
405405

tests/MySqlConnector.Tests/CancellationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ public async Task ExecuteAsync(int step, int method)
400400

401401
public static IEnumerable<object[]> GetSyncMethodSteps()
402402
{
403-
for (var step = 1; step <= 12; step++)
403+
for (var step = 1; step <= 12; step++)
404404
{
405405
for (var method = 0; method < s_executeMethods.Length; method++)
406406
{

0 commit comments

Comments
 (0)