Quick refactor of the connection service

Refactoring to match the layout of the other services.
This commit is contained in:
Benjamin Russell
2016-07-27 16:45:01 -07:00
parent ad008db4f5
commit 2ea5cf3457
6 changed files with 44 additions and 30 deletions

View File

@@ -5,7 +5,7 @@
using Microsoft.SqlTools.ServiceLayer.Hosting.Protocol.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.Connection
namespace Microsoft.SqlTools.ServiceLayer.ConnectionServices.Contracts
{
/// <summary>
/// Message format for the initial connection request

View File

@@ -5,19 +5,8 @@
using System.Collections.Generic;
namespace Microsoft.SqlTools.ServiceLayer.Connection
namespace Microsoft.SqlTools.ServiceLayer.ConnectionServices.Contracts
{
/// <summary>
/// Interface for the SQL Connection factory
/// </summary>
public interface ISqlConnectionFactory
{
/// <summary>
/// Create a new SQL Connection object
/// </summary>
ISqlConnection CreateSqlConnection();
}
/// <summary>
/// Interface for the SQL Connection wrapper
/// </summary>

View File

@@ -0,0 +1,18 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.SqlTools.ServiceLayer.ConnectionServices.Contracts
{
/// <summary>
/// Interface for the SQL Connection factory
/// </summary>
public interface ISqlConnectionFactory
{
/// <summary>
/// Create a new SQL Connection object
/// </summary>
ISqlConnection CreateSqlConnection();
}
}

View File

@@ -7,24 +7,8 @@ using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
namespace Microsoft.SqlTools.ServiceLayer.Connection
namespace Microsoft.SqlTools.ServiceLayer.ConnectionServices.Contracts
{
/// <summary>
/// Factory class to create SqlClientConnections
/// The purpose of the factory is to make it easier to mock out the database
/// in 'offline' unit test scenarios.
/// </summary>
public class SqlConnectionFactory : ISqlConnectionFactory
{
/// <summary>
/// Creates a new SqlClientConnection object
/// </summary>
public ISqlConnection CreateSqlConnection()
{
return new SqlClientConnection();
}
}
/// <summary>
/// Wrapper class that implements ISqlConnection and hosts a SqlConnection.
/// This wrapper exists primarily for decoupling to support unit testing.

View File

@@ -0,0 +1,23 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.SqlTools.ServiceLayer.ConnectionServices.Contracts
{
/// <summary>
/// Factory class to create SqlClientConnections
/// The purpose of the factory is to make it easier to mock out the database
/// in 'offline' unit test scenarios.
/// </summary>
public class SqlConnectionFactory : ISqlConnectionFactory
{
/// <summary>
/// Creates a new SqlClientConnection object
/// </summary>
public ISqlConnection CreateSqlConnection()
{
return new SqlClientConnection();
}
}
}