* 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>
29 lines
1.1 KiB
C#
29 lines
1.1 KiB
C#
// Copyright (c) Umbraco.
|
|
// See LICENSE for more details.
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Umbraco.Cms.Tests.Integration.Implementations;
|
|
|
|
namespace Umbraco.Cms.Tests.Integration.Extensions
|
|
{
|
|
public static class ServiceCollectionExtensions
|
|
{
|
|
/// <summary>
|
|
/// These services need to be manually added because they do not get added by the generic host
|
|
/// </summary>
|
|
public static void AddRequiredNetCoreServices(this IServiceCollection services, TestHelper testHelper, IWebHostEnvironment webHostEnvironment)
|
|
{
|
|
services.AddSingleton<IHttpContextAccessor>(x => testHelper.GetHttpContextAccessor());
|
|
|
|
// The generic host does add IHostEnvironment but not this one because we are not actually in a web context
|
|
services.AddSingleton<IWebHostEnvironment>(x => webHostEnvironment);
|
|
|
|
// Replace the IHostEnvironment that generic host created too
|
|
services.AddSingleton<IHostEnvironment>(x => webHostEnvironment);
|
|
}
|
|
}
|
|
}
|