* Update gitignore * Move csproj * Update project references * Update solutions * Update build scripts * Tests used to share editorconfig with projects in src * Fix broken tests. * Stop copying around .editorconfig merged root one with linting * csharp_style_expression_bodied -> suggestion * Move StyleCop rulesets to matching directories and update shared build properties * Remove legacy build files, update NuGet.cofig and solution files * Restore myget source * Clean up .gitignore * Update .gitignore * Move new test classes to tests after merge * Gitignore + nuget config * Move new test Co-authored-by: Ronald Barendse <ronald@barend.se>
36 lines
1.6 KiB
C#
36 lines
1.6 KiB
C#
// Copyright (c) Umbraco.
|
|
// See LICENSE for more details.
|
|
|
|
using NUnit.Framework;
|
|
using Umbraco.Cms.Core.Configuration;
|
|
using Umbraco.Cms.Core.Configuration.Models;
|
|
using Constants = Umbraco.Cms.Core.Constants;
|
|
|
|
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Configuration.Models
|
|
{
|
|
public class ConnectionStringsTests
|
|
{
|
|
[Test]
|
|
[TestCase("", ExpectedResult = null)]
|
|
[TestCase(null, ExpectedResult = null)]
|
|
[TestCase(@"Data Source=|DataDirectory|\Umbraco.sdf;Flush Interval=1;", ExpectedResult = Constants.DbProviderNames.SqlCe)]
|
|
[TestCase(@"Server=(LocalDb)\Umbraco;Database=NetCore;Integrated Security=true", ExpectedResult = Constants.DbProviderNames.SqlServer)]
|
|
[TestCase(@"Data Source=(LocalDb)\Umbraco;Initial Catalog=NetCore;Integrated Security=true;", ExpectedResult = Constants.DbProviderNames.SqlServer)]
|
|
[TestCase(@"Data Source=.\SQLExpress;Integrated Security=true;AttachDbFilename=MyDataFile.mdf;", ExpectedResult = Constants.DbProviderNames.SqlServer)]
|
|
public string ParseProviderName(string connectionString)
|
|
{
|
|
var connectionStrings = new ConnectionStrings
|
|
{
|
|
UmbracoConnectionString = new ConfigConnectionString(Constants.System.UmbracoConnectionName, connectionString)
|
|
};
|
|
|
|
var actual = connectionStrings.UmbracoConnectionString;
|
|
|
|
Assert.AreEqual(connectionString, actual.ConnectionString);
|
|
Assert.AreEqual(Constants.System.UmbracoConnectionName, actual.Name);
|
|
|
|
return connectionStrings.UmbracoConnectionString.ProviderName;
|
|
}
|
|
}
|
|
}
|