2017-07-20 11:21:28 +02: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;
|
|
|
|
|
|
using Moq;
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
using Umbraco.Core.Cache;
|
2017-05-30 15:46:25 +02:00
|
|
|
|
using Umbraco.Core.Composing;
|
2018-12-12 14:28:57 +01:00
|
|
|
|
using Umbraco.Core.Configuration;
|
2019-02-15 08:46:57 +01:00
|
|
|
|
using Umbraco.Core.IO;
|
2015-01-16 15:47:44 +11:00
|
|
|
|
using Umbraco.Core.Logging;
|
2018-04-06 13:51:54 +10:00
|
|
|
|
using Umbraco.Tests.TestHelpers;
|
2015-01-16 15:47:44 +11:00
|
|
|
|
|
2018-02-02 19:43:03 +01:00
|
|
|
|
namespace Umbraco.Tests.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
|
|
|
|
|
2018-11-27 13:46:43 +01:00
|
|
|
|
protected IProfilingLogger ProfilingLogger { get; private set; }
|
2015-01-16 15:47:44 +11:00
|
|
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
|
|
public void Initialize()
|
|
|
|
|
|
{
|
|
|
|
|
|
ProfilingLogger = new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>());
|
|
|
|
|
|
|
2019-11-08 14:26:06 +11:00
|
|
|
|
var typeFinder = new TypeFinder(Mock.Of<ILogger>());
|
2019-11-11 18:56:14 +11:00
|
|
|
|
var ioHelper = IOHelper.Default;
|
|
|
|
|
|
TypeLoader = new TypeLoader(ioHelper, typeFinder, NoAppCache.Instance, new DirectoryInfo(ioHelper.MapPath("~/App_Data/TEMP")), ProfilingLogger, false, AssembliesToScan);
|
2015-01-16 15:47:44 +11:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-08-07 16:45:41 +02:00
|
|
|
|
[TearDown]
|
|
|
|
|
|
public void TearDown()
|
|
|
|
|
|
{
|
2016-08-19 11:13:19 +02:00
|
|
|
|
Current.Reset();
|
2016-08-07 16:45:41 +02: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
|
|
|
|
}
|