Migrated content controller + related

Signed-off-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
Bjarke Berg
2020-06-09 13:48:50 +02:00
parent b9da273cbd
commit 609c1ffc5b
34 changed files with 1556 additions and 955 deletions

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;
using Umbraco.Extensions;
using Umbraco.Web.BackOffice.Controllers;
namespace Umbraco.Tests.Integration.TestServer.Controllers
{
public class BackOfficeAssetsControllerTests: UmbracoWebApplicationFactory
{
private LinkGenerator _linkGenerator;
[OneTimeSetUp]
public void GivenARequestToTheController()
{
_linkGenerator = Services.GetRequiredService<LinkGenerator>();
}
[Test]
public async Task EnsureSuccessStatusCode()
{
// Arrange
var client = CreateClient();
var url = _linkGenerator.GetUmbracoApiService<BackOfficeAssetsController>(x=>x.GetSupportedLocales());
// Act
var response = await client.GetAsync(url);
// Assert
Assert.GreaterOrEqual((int)response.StatusCode, 200);
Assert.Less((int)response.StatusCode, 300);
}
}
}

View File

@@ -0,0 +1,9 @@
using Microsoft.AspNetCore.Mvc.Testing;
using Umbraco.Web.UI.BackOffice;
namespace Umbraco.Tests.Integration.TestServer
{
public class UmbracoWebApplicationFactory : WebApplicationFactory<Startup>
{
}
}

View File

@@ -15,6 +15,7 @@
<ItemGroup>
<PackageReference Include="LightInject.Microsoft.DependencyInjection" Version="3.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="nunit" Version="3.12.0" />
@@ -30,6 +31,7 @@
<ProjectReference Include="..\Umbraco.Infrastructure\Umbraco.Infrastructure.csproj" />
<ProjectReference Include="..\Umbraco.Tests.Common\Umbraco.Tests.Common.csproj" />
<ProjectReference Include="..\Umbraco.Web.BackOffice\Umbraco.Web.BackOffice.csproj" />
<ProjectReference Include="..\Umbraco.Web.UI.NetCore\Umbraco.Web.UI.NetCore.csproj" />
<ProjectReference Include="..\Umbraco.Web.Website\Umbraco.Web.Website.csproj" />
</ItemGroup>