2020-12-20 08:36:11 +01:00
|
|
|
// Copyright (c) Umbraco.
|
|
|
|
|
// See LICENSE for more details.
|
|
|
|
|
|
2020-12-08 10:42:26 +11:00
|
|
|
using System.Collections.Generic;
|
2019-11-11 18:56:14 +11:00
|
|
|
using System.IO;
|
2015-01-16 15:47:44 +11:00
|
|
|
using System.Reflection;
|
2020-09-28 14:59:17 +02:00
|
|
|
using Microsoft.Extensions.Logging;
|
2015-01-16 15:47:44 +11:00
|
|
|
using Moq;
|
|
|
|
|
using NUnit.Framework;
|
2021-02-18 11:06:02 +01:00
|
|
|
using Umbraco.Cms.Core.Cache;
|
|
|
|
|
using Umbraco.Cms.Core.Composing;
|
|
|
|
|
using Umbraco.Cms.Core.Logging;
|
|
|
|
|
using Umbraco.Cms.Tests.UnitTests.TestHelpers;
|
|
|
|
|
using Constants = Umbraco.Cms.Core.Constants;
|
2015-01-16 15:47:44 +11:00
|
|
|
|
2021-02-18 11:06:02 +01:00
|
|
|
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Composing
|
2015-01-16 15:47:44 +11:00
|
|
|
{
|
2018-02-02 19:43:03 +01:00
|
|
|
public abstract class ComposingTestBase
|
2015-01-16 15:47:44 +11:00
|
|
|
{
|
2017-05-30 15:33:13 +02:00
|
|
|
protected TypeLoader TypeLoader { get; private set; }
|
2018-02-02 19:43:03 +01:00
|
|
|
|
2015-01-16 15:47:44 +11:00
|
|
|
[SetUp]
|
|
|
|
|
public void Initialize()
|
|
|
|
|
{
|
2020-03-09 13:31:56 +11:00
|
|
|
var typeFinder = TestHelper.GetTypeFinder();
|
2021-07-09 16:15:37 -06:00
|
|
|
TypeLoader = new TypeLoader(typeFinder, new VaryingRuntimeHash(), NoAppCache.Instance, new DirectoryInfo(TestHelper.GetHostingEnvironment().MapPathContentRoot(Constants.SystemDirectories.TempData)), Mock.Of<ILogger<TypeLoader>>(), Mock.Of<IProfiler>(), false, AssembliesToScan);
|
2015-01-16 15:47:44 +11:00
|
|
|
}
|
2020-10-26 13:34:08 +01:00
|
|
|
|
2017-07-20 11:21:28 +02:00
|
|
|
protected virtual IEnumerable<Assembly> AssembliesToScan
|
|
|
|
|
=> new[]
|
2015-01-16 15:47:44 +11:00
|
|
|
{
|
2016-08-25 15:09:51 +02:00
|
|
|
GetType().Assembly // this assembly only
|
|
|
|
|
};
|
2015-01-16 15:47:44 +11:00
|
|
|
}
|
2017-07-20 11:21:28 +02:00
|
|
|
}
|