Assert that the view exists in InstallControllerTest

This commit is contained in:
Mole
2020-08-21 14:20:30 +02:00
parent 157068105c
commit 00f1e4a247

View File

@@ -13,6 +13,7 @@ using AutoFixture.NUnit3;
using Umbraco.Core.Hosting;
using System.IO;
using System.Reflection;
using System.Linq;
namespace Umbraco.Tests.UnitTests.Umbraco.Web.Common
{
@@ -29,7 +30,11 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Web.Common
var viewResult = await sut.Index() as ViewResult;
var sections = viewResult.ViewName.Split("\\");
var fileName = sections[sections.Length - 1];
var location = new FileInfo(typeof(InstallController).Assembly.Location).Directory;
// TODO: Don't use DirectoryInfo to get contents of UmbracoInstall, use something that works everywhere.
var views = new DirectoryInfo(@"..\\..\\..\\..\\Umbraco.Web.UI.NetCore\\umbraco\\UmbracoInstall").GetFiles()
.Select(f => f.Name).ToArray();
Assert.True(views.Contains(fileName), $"Expected {fileName} to exist, but it didn't");
}
}
}