Skip to content

Commit a7044f1

Browse files
committed
Move GetSchema tests to their own class.
1 parent f0c58a7 commit a7044f1

File tree

3 files changed

+46
-27
lines changed

3 files changed

+46
-27
lines changed

tests/SideBySide/ConnectionTests.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Data;
3-
using System.Data.Common;
43
using Dapper;
54
using MySql.Data.MySqlClient;
65
using Xunit;
@@ -242,17 +241,6 @@ public void CloneWithCopiesExistingPassword()
242241
connection2.Open();
243242
Assert.Equal(ConnectionState.Open, connection2.State);
244243
}
245-
#endif
246-
#if !NETCOREAPP1_1_2
247-
[Fact]
248-
public void GetDataSourceInformationSchemaCollection()
249-
{
250-
using var connection = new MySqlConnection(AppConfig.ConnectionString);
251-
connection.Open();
252-
253-
var dataTable = connection.GetSchema(DbMetaDataCollectionNames.DataSourceInformation);
254-
Assert.Equal(connection.ServerVersion, dataTable.Rows[0]["DataSourceProductVersion"]);
255-
}
256244
#endif
257245
}
258246
}

tests/SideBySide/QueryTests.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,21 +1032,6 @@ public void HasRowsRepeated()
10321032
Assert.True(reader.HasRows);
10331033
}
10341034

1035-
#if !NETCOREAPP1_1_2
1036-
[Fact]
1037-
public void ReservedWordsSchema()
1038-
{
1039-
var table = m_database.Connection.GetSchema("ReservedWords");
1040-
Assert.NotNull(table);
1041-
Assert.Single(table.Columns);
1042-
Assert.Equal("ReservedWord", table.Columns[0].ColumnName);
1043-
#if !BASELINE
1044-
// https://bugs.mysql.com/bug.php?id=89639
1045-
Assert.Contains("CREATE", table.Rows.Cast<DataRow>().Select(x => (string) x[0]));
1046-
#endif
1047-
}
1048-
#endif
1049-
10501035
[Fact]
10511036
public void CommandBehaviorCloseConnection()
10521037
{
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#if !NETCOREAPP1_1_2
2+
using System;
3+
using System.Data;
4+
using System.Data.Common;
5+
using System.Linq;
6+
using Xunit;
7+
8+
namespace SideBySide
9+
{
10+
public class SchemaProviderTests : IClassFixture<DatabaseFixture>, IDisposable
11+
{
12+
public SchemaProviderTests(DatabaseFixture database)
13+
{
14+
m_database = database;
15+
m_database.Connection.Open();
16+
}
17+
18+
public void Dispose()
19+
{
20+
m_database.Connection.Close();
21+
}
22+
23+
[Fact]
24+
public void GetDataSourceInformationSchemaCollection()
25+
{
26+
var dataTable = m_database.Connection.GetSchema(DbMetaDataCollectionNames.DataSourceInformation);
27+
Assert.Equal(m_database.Connection.ServerVersion, dataTable.Rows[0]["DataSourceProductVersion"]);
28+
}
29+
30+
[Fact]
31+
public void ReservedWordsSchema()
32+
{
33+
var table = m_database.Connection.GetSchema("ReservedWords");
34+
Assert.NotNull(table);
35+
Assert.Single(table.Columns);
36+
Assert.Equal("ReservedWord", table.Columns[0].ColumnName);
37+
#if !BASELINE
38+
// https://bugs.mysql.com/bug.php?id=89639
39+
Assert.Contains("CREATE", table.Rows.Cast<DataRow>().Select(x => (string) x[0]));
40+
#endif
41+
}
42+
43+
readonly DatabaseFixture m_database;
44+
}
45+
}
46+
#endif

0 commit comments

Comments
 (0)