-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
OdbcConnectionSchemaTests.cs
36 lines (31 loc) · 1.1 KB
/
OdbcConnectionSchemaTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Xunit;
namespace System.Data.Odbc.Tests
{
public class OdbcConnectionSchemaTests
{
[CheckConnStrSetupFact]
public void TestConnectionSchemaOnOpenConnection()
{
string connectionString = DataTestUtility.OdbcConnStr;
using (OdbcConnection connection = new OdbcConnection(connectionString))
{
connection.GetSchema();
connection.Open();
DataTable schema = connection.GetSchema();
Assert.NotNull(schema);
DataTable tableSchema = connection.GetSchema("Tables");
Assert.NotNull(tableSchema);
}
}
[Fact]
public void TestConnectionSchemaOnNonOpenConnection()
{
using (OdbcConnection connection = new OdbcConnection(string.Empty))
{
Assert.Throws<InvalidOperationException>(() => connection.GetSchema());
}
}
}
}