Files
sqltoolsservice/test/Microsoft.Kusto.ServiceLayer.UnitTests/Connection/DataSourceConnectionFactoryTests.cs
Justin M f0a5e11d51 dSTS Authentication (#1125)
* Refactored Kusto.ServiceLayer to pass ConnectionDetails to DataSourceFactory instead of connection string. Created KustoConnectionDetails to map needed details to KustoClient.

* Removed unused ScriptingScriptOperation from KustoServiceLayer.

* Created DstsAuthenticationManager and moved logic for getting DstsToken. Updated error message for failing to create KustoConnection.

* Removed DstsAuthenticationManager.cs. Refactored DataSourceFactory to retrieve UserToken from ConnectionDetails.

* Renamed AzureAccountToken in ConnectionDetails to AccountToken. Changed mapping to KustoConnectionDetails based on the AccountToken.

* Removed Kusto.Data reference from ConnectionService and ScriptingListObjectsOperation. Moved creation of KustoConnectionStringBuilder to DataSourceFactory

* Added accountToken validation to DataSourceFactory Create.

* Renamed KustoConnectionDetails to DataSourceConnectionDetails. Renamed AzureToken to AuthToken.
2021-01-14 13:49:09 -08:00

21 lines
745 B
C#

using Microsoft.Kusto.ServiceLayer.Connection;
using Microsoft.Kusto.ServiceLayer.Connection.Contracts;
using Microsoft.Kusto.ServiceLayer.DataSource;
using Moq;
using NUnit.Framework;
namespace Microsoft.Kusto.ServiceLayer.UnitTests.Connection
{
public class DataSourceConnectionFactoryTests
{
[Test]
public void CreateDataSourceConnection_Returns_Connection()
{
var dataSourceFactoryMock = new Mock<IDataSourceFactory>();
var connectionFactory = new DataSourceConnectionFactory(dataSourceFactoryMock.Object);
var connection = connectionFactory.CreateDataSourceConnection(new ConnectionDetails(), "");
Assert.IsNotNull(connection);
}
}
}