-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev: added connection specification tests (#256)
* Invoke OnStateChange in YdbConnection (Open -> Close, Close -> Open) * Impl DbProviderFactory * Dev: added DbConnection specification tests from MySql Connector
- Loading branch information
1 parent
bc0e095
commit 23e4818
Showing
11 changed files
with
160 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Data.Common; | ||
|
||
namespace Ydb.Sdk.Ado; | ||
|
||
public class YdbProviderFactory : DbProviderFactory | ||
{ | ||
public static readonly YdbProviderFactory Instance = new(); | ||
|
||
public override YdbCommand CreateCommand() | ||
{ | ||
return new YdbCommand(); | ||
} | ||
|
||
public override YdbConnection CreateConnection() | ||
{ | ||
return new YdbConnection(); | ||
} | ||
|
||
public override YdbConnectionStringBuilder CreateConnectionStringBuilder() | ||
{ | ||
return new YdbConnectionStringBuilder(); | ||
} | ||
|
||
public override DbParameter CreateParameter() | ||
{ | ||
return new YdbParameter(); | ||
} | ||
|
||
#if NET7_0_OR_GREATER | ||
public override YdbDataSource CreateDataSource(string connectionString) | ||
{ | ||
return new YdbDataSource(); | ||
} | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using AdoNet.Specification.Tests; | ||
using Xunit; | ||
|
||
namespace Ydb.Sdk.Tests.Ado.Specification; | ||
|
||
public class YdbConnectionTests : ConnectionTestBase<YdbFactoryFixture> | ||
{ | ||
public YdbConnectionTests(YdbFactoryFixture fixture) : base(fixture) | ||
{ | ||
} | ||
|
||
#pragma warning disable xUnit1004 | ||
[Fact(Skip = "IComponent legacy.")] | ||
#pragma warning restore xUnit1004 | ||
public override void Dispose_raises_Disposed() | ||
{ | ||
base.Dispose_raises_Disposed(); | ||
} | ||
|
||
#pragma warning disable xUnit1004 | ||
[Fact(Skip = "IComponent legacy.")] | ||
#pragma warning restore xUnit1004 | ||
public override Task DisposeAsync_raises_Disposed() | ||
{ | ||
return base.DisposeAsync_raises_Disposed(); | ||
} | ||
|
||
#pragma warning disable xUnit1004 | ||
[Fact(Skip = "Connect to default settings 'grpc://localhost:2136/local'.")] | ||
#pragma warning restore xUnit1004 | ||
public override void Open_throws_when_no_connection_string() | ||
{ | ||
base.Open_throws_when_no_connection_string(); | ||
} | ||
|
||
#pragma warning disable xUnit1004 | ||
[Fact(Skip = "TODO Supported this field.")] | ||
#pragma warning restore xUnit1004 | ||
public override void ServerVersion_returns_value() | ||
{ | ||
base.ServerVersion_returns_value(); | ||
} | ||
|
||
#pragma warning disable xUnit1004 | ||
[Fact(Skip = "TODO Supported cancel OpenAsync.")] | ||
#pragma warning restore xUnit1004 | ||
public override Task OpenAsync_is_canceled() | ||
{ | ||
return base.OpenAsync_is_canceled(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.Data.Common; | ||
using AdoNet.Specification.Tests; | ||
using Ydb.Sdk.Ado; | ||
|
||
namespace Ydb.Sdk.Tests.Ado.Specification; | ||
|
||
public class YdbFactoryFixture : IDbFactoryFixture | ||
{ | ||
public DbProviderFactory Factory => YdbProviderFactory.Instance; | ||
|
||
public string ConnectionString => "Host=localhost;Port=2136;Database=local"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters