Skip to content

Commit

Permalink
Make the test class disposable.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrainger committed Oct 28, 2023
1 parent 4dd8a32 commit dd4e061
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 3 additions & 1 deletion tests/MySqlConnector.Tests/Metrics/ConnectionsUsageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

namespace MySqlConnector.Tests.Metrics;

public class ConnectionsUsageTests : MetricsTestsBase
public class ConnectionsUsageTests : MetricsTestsBase, IDisposable
{
[Fact]
public void NoDataSource()
{
CreateConnectionStringBuilder();
}

public void Dispose() => StopServer();
}
9 changes: 3 additions & 6 deletions tests/MySqlConnector.Tests/Metrics/MetricsTestsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace MySqlConnector.Tests.Metrics;

public abstract class MetricsTestsBase : IDisposable
public abstract class MetricsTestsBase
{
public MetricsTestsBase()
{
Expand All @@ -19,13 +19,10 @@ public MetricsTestsBase()
};
}

public void Dispose()
{
m_server.Stop();
}

protected string? PoolName { get; set; }

protected void StopServer() => m_server.Stop();

protected MySqlConnectionStringBuilder CreateConnectionStringBuilder() =>
new(m_csb.ConnectionString);

Expand Down

0 comments on commit dd4e061

Please sign in to comment.