Updated install steps, classes and logic
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Web.Install.Controllers;
|
||||
using Umbraco.Web.Install.Models;
|
||||
|
||||
namespace Umbraco.Tests.Install
|
||||
{
|
||||
[TestFixture]
|
||||
public class InstallApiControllerTests
|
||||
{
|
||||
|
||||
//[Test]
|
||||
//public void Can_Execute_Step()
|
||||
//{
|
||||
// var step = new InstallSetupStep<DatabaseModel>()
|
||||
// {
|
||||
// Name = "Database",
|
||||
// View = "database",
|
||||
// ServerOrder = 0,
|
||||
// RequiresRestart = true,
|
||||
// ExecuteCallback = model => LogHelper.Info<InstallApiControllerTests>("installing....")
|
||||
// };
|
||||
|
||||
// var instruction = JObject.FromObject(new
|
||||
// {
|
||||
// dbType = 0,
|
||||
// server = "localhost",
|
||||
// databaseName = "test",
|
||||
// login = "sa",
|
||||
// password = "test",
|
||||
// integratedAuth = false,
|
||||
// connectionString = string.Empty
|
||||
// });
|
||||
|
||||
// Assert.DoesNotThrow(() => InstallApiController.ExecuteStep(step, instruction));
|
||||
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
97
src/Umbraco.Tests/Install/InstallHelperTests.cs
Normal file
97
src/Umbraco.Tests/Install/InstallHelperTests.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using Moq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Install;
|
||||
using Umbraco.Web.Install.Controllers;
|
||||
using Umbraco.Web.Install.InstallSteps;
|
||||
using Umbraco.Web.Install.Models;
|
||||
|
||||
namespace Umbraco.Tests.Install
|
||||
{
|
||||
[TestFixture]
|
||||
public class InstallHelperTests
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void Get_Steps()
|
||||
{
|
||||
var appCtx = new ApplicationContext(CacheHelper.CreateDisabledCacheHelper());
|
||||
ApplicationContext.EnsureContext(appCtx, true);
|
||||
|
||||
var umbCtx = UmbracoContext.EnsureContext(
|
||||
new Mock<HttpContextBase>().Object,
|
||||
appCtx,
|
||||
true);
|
||||
|
||||
var helper = new InstallHelper(umbCtx, InstallStatusType.NewInstall);
|
||||
|
||||
var steps = helper.GetSteps().ToArray();
|
||||
|
||||
var expected = new[]
|
||||
{
|
||||
typeof (FilePermissionsStep), typeof (UserStep), typeof(MajorVersion7UpgradeReport), typeof (DatabaseConfigureStep), typeof (DatabaseInstallStep),
|
||||
typeof (DatabaseUpgradeStep), typeof (StarterKitDownloadStep), typeof (StarterKitInstallStep), typeof (StarterKitCleanupStep),
|
||||
typeof (SetUmbracoVersionStep)
|
||||
};
|
||||
|
||||
Assert.AreEqual(expected.Length, steps.Length);
|
||||
|
||||
for (int i = 0; i < expected.Length; i++)
|
||||
{
|
||||
var type = expected[i];
|
||||
Assert.AreEqual(type, steps[i].GetType());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_Steps_New_Install()
|
||||
{
|
||||
var appCtx = new ApplicationContext(CacheHelper.CreateDisabledCacheHelper());
|
||||
ApplicationContext.EnsureContext(appCtx, true);
|
||||
|
||||
var umbCtx = UmbracoContext.EnsureContext(
|
||||
new Mock<HttpContextBase>().Object,
|
||||
appCtx,
|
||||
true);
|
||||
|
||||
var helper = new InstallHelper(umbCtx, InstallStatusType.NewInstall);
|
||||
|
||||
var steps = helper.GetSteps().ToArray();
|
||||
|
||||
//for new installs 2, don't require execution
|
||||
Assert.AreEqual(2, steps.Count(x => x.RequiresExecution() == false));
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_Steps_Upgrade()
|
||||
{
|
||||
var appCtx = new ApplicationContext(CacheHelper.CreateDisabledCacheHelper());
|
||||
ApplicationContext.EnsureContext(appCtx, true);
|
||||
|
||||
var umbCtx = UmbracoContext.EnsureContext(
|
||||
new Mock<HttpContextBase>().Object,
|
||||
appCtx,
|
||||
true);
|
||||
|
||||
var helper = new InstallHelper(umbCtx, InstallStatusType.Upgrade);
|
||||
|
||||
var steps = helper.GetSteps().ToArray();
|
||||
|
||||
//for new installs 4, don't require execution
|
||||
Assert.AreEqual(4, steps.Count(x => x.RequiresExecution() == false));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -169,7 +169,7 @@
|
||||
<Compile Include="AngularIntegration\JsInitializationTests.cs" />
|
||||
<Compile Include="AngularIntegration\ServerVariablesParserTests.cs" />
|
||||
<Compile Include="AttemptTests.cs" />
|
||||
<Compile Include="Install\InstallApiControllerTests.cs" />
|
||||
<Compile Include="Install\InstallHelperTests.cs" />
|
||||
<Compile Include="Membership\MembershipProviderBaseTests.cs" />
|
||||
<Compile Include="Membership\UmbracoServiceMembershipProviderTests.cs" />
|
||||
<Compile Include="MockTests.cs" />
|
||||
|
||||
Reference in New Issue
Block a user