mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-21 03:57:19 +01:00
DBConnectionFactory -> DatabaseConnectionFactory
Removes unused using.
This commit is contained in:
@@ -133,7 +133,7 @@ namespace Tgstation.Server.Host.Core
|
||||
|
||||
// other stuff needed for for setup wizard and configuration
|
||||
services.AddSingleton<IConsole, IO.Console>();
|
||||
services.AddSingleton<IDBConnectionFactory, DBConnectionFactory>();
|
||||
services.AddSingleton<IDatabaseConnectionFactory, DatabaseConnectionFactory>();
|
||||
services.AddSingleton<ISetupWizard, SetupWizard>();
|
||||
services.AddSingleton<IPlatformIdentifier, PlatformIdentifier>();
|
||||
services.AddSingleton<IAsyncDelayer, AsyncDelayer>();
|
||||
|
||||
+1
-2
@@ -2,13 +2,12 @@
|
||||
using System;
|
||||
using System.Data.Common;
|
||||
using System.Data.SqlClient;
|
||||
using System.Globalization;
|
||||
using Tgstation.Server.Host.Configuration;
|
||||
|
||||
namespace Tgstation.Server.Host.Core
|
||||
{
|
||||
/// <inheritdoc />
|
||||
sealed class DBConnectionFactory : IDBConnectionFactory
|
||||
sealed class DatabaseConnectionFactory : IDatabaseConnectionFactory
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public DbConnection CreateConnection(string connectionString, DatabaseType databaseType)
|
||||
+1
-1
@@ -6,7 +6,7 @@ namespace Tgstation.Server.Host.Core
|
||||
/// <summary>
|
||||
/// For creating <see cref="DbConnection"/>
|
||||
/// </summary>
|
||||
interface IDBConnectionFactory
|
||||
interface IDatabaseConnectionFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a <see cref="DbConnection"/>
|
||||
@@ -42,9 +42,9 @@ namespace Tgstation.Server.Host.Core
|
||||
readonly IApplication application;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IDBConnectionFactory"/> for the <see cref="SetupWizard"/>
|
||||
/// The <see cref="IDatabaseConnectionFactory"/> for the <see cref="SetupWizard"/>
|
||||
/// </summary>
|
||||
readonly IDBConnectionFactory dbConnectionFactory;
|
||||
readonly IDatabaseConnectionFactory dbConnectionFactory;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IPlatformIdentifier"/> for the <see cref="SetupWizard"/>
|
||||
@@ -78,7 +78,7 @@ namespace Tgstation.Server.Host.Core
|
||||
/// <param name="asyncDelayer">The value of <see cref="asyncDelayer"/></param>
|
||||
/// <param name="logger">The value of <see cref="logger"/></param>
|
||||
/// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/></param>
|
||||
public SetupWizard(IIOManager ioManager, IConsole console, IHostingEnvironment hostingEnvironment, IApplication application, IDBConnectionFactory dbConnectionFactory, IPlatformIdentifier platformIdentifier, IAsyncDelayer asyncDelayer, ILogger<SetupWizard> logger, IOptions<GeneralConfiguration> generalConfigurationOptions)
|
||||
public SetupWizard(IIOManager ioManager, IConsole console, IHostingEnvironment hostingEnvironment, IApplication application, IDatabaseConnectionFactory dbConnectionFactory, IPlatformIdentifier platformIdentifier, IAsyncDelayer asyncDelayer, ILogger<SetupWizard> logger, IOptions<GeneralConfiguration> generalConfigurationOptions)
|
||||
{
|
||||
this.ioManager = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
|
||||
this.console = console ?? throw new ArgumentNullException(nameof(console));
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Tgstation.Server.Host.Core.Tests
|
||||
[TestMethod]
|
||||
public void TestBadParameters()
|
||||
{
|
||||
var factory = new DBConnectionFactory();
|
||||
var factory = new DatabaseConnectionFactory();
|
||||
Assert.ThrowsException<ArgumentNullException>(() => factory.CreateConnection(null, default));
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => factory.CreateConnection(String.Empty, (DatabaseType)42));
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace Tgstation.Server.Host.Core.Tests
|
||||
[TestMethod]
|
||||
public void TestWorks()
|
||||
{
|
||||
var factory = new DBConnectionFactory();
|
||||
var factory = new DatabaseConnectionFactory();
|
||||
Assert.IsInstanceOfType(factory.CreateConnection(String.Empty, DatabaseType.MariaDB), typeof(MySqlConnection));
|
||||
Assert.IsInstanceOfType(factory.CreateConnection(String.Empty, DatabaseType.MySql), typeof(MySqlConnection));
|
||||
Assert.IsInstanceOfType(factory.CreateConnection(String.Empty, DatabaseType.SqlServer), typeof(SqlConnection));
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Tgstation.Server.Host.Core.Tests
|
||||
Assert.ThrowsException<ArgumentNullException>(() => new SetupWizard(mockIOManager.Object, mockConsole.Object, mockHostingEnvironment.Object, null, null, null, null, null, null));
|
||||
var mockApplication = new Mock<IApplication>();
|
||||
Assert.ThrowsException<ArgumentNullException>(() => new SetupWizard(mockIOManager.Object, mockConsole.Object, mockHostingEnvironment.Object, mockApplication.Object, null, null, null, null, null));
|
||||
var mockDBConnectionFactory = new Mock<IDBConnectionFactory>();
|
||||
var mockDBConnectionFactory = new Mock<IDatabaseConnectionFactory>();
|
||||
Assert.ThrowsException<ArgumentNullException>(() => new SetupWizard(mockIOManager.Object, mockConsole.Object, mockHostingEnvironment.Object, mockApplication.Object, mockDBConnectionFactory.Object, null, null, null, null));
|
||||
var mockPlatformIdentifier = new Mock<IPlatformIdentifier>();
|
||||
Assert.ThrowsException<ArgumentNullException>(() => new SetupWizard(mockIOManager.Object, mockConsole.Object, mockHostingEnvironment.Object, mockApplication.Object, mockDBConnectionFactory.Object, mockPlatformIdentifier.Object, null, null, null));
|
||||
@@ -48,7 +48,7 @@ namespace Tgstation.Server.Host.Core.Tests
|
||||
var mockConsole = new Mock<IConsole>();
|
||||
var mockHostingEnvironment = new Mock<IHostingEnvironment>();
|
||||
var mockApplication = new Mock<IApplication>();
|
||||
var mockDBConnectionFactory = new Mock<IDBConnectionFactory>();
|
||||
var mockDBConnectionFactory = new Mock<IDatabaseConnectionFactory>();
|
||||
var mockLogger = new Mock<ILogger<SetupWizard>>();
|
||||
var mockGeneralConfigurationOptions = new Mock<IOptions<GeneralConfiguration>>();
|
||||
var mockPlatformIdentifier = new Mock<IPlatformIdentifier>();
|
||||
|
||||
Reference in New Issue
Block a user