this gives us more control over all Resolvers and streamlines them. Created IBootManager, CoreBootManager and WebBootManager to handle the application initialization including the creation of Resolvers. This means that if people are using the dlls outside of the web app, they can run the boot strappers to initialize everything.
98 lines
2.2 KiB
C#
98 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using NUnit.Framework;
|
|
using Umbraco.Core;
|
|
using Umbraco.Tests.TestHelpers;
|
|
using umbraco.BusinessLogic;
|
|
using umbraco.cms.businesslogic.media;
|
|
|
|
namespace Umbraco.Tests
|
|
{
|
|
[TestFixture]
|
|
public class MediaFactoryTests
|
|
{
|
|
[SetUp]
|
|
public void Initialize()
|
|
{
|
|
TestHelper.SetupLog4NetForTests();
|
|
|
|
//this ensures its reset
|
|
PluginManager.Current = new PluginManager();
|
|
|
|
//for testing, we'll specify which assemblies are scanned for the PluginTypeResolver
|
|
PluginManager.Current.AssembliesToScan = new[]
|
|
{
|
|
this.GetType().Assembly
|
|
};
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ensures that the media factory finds the correct number of IMediaFactory
|
|
/// </summary>
|
|
[Test]
|
|
public void Find_Media_Factories()
|
|
{
|
|
var factories = MediaFactory.Factories;
|
|
Assert.AreEqual(2, factories.Count());
|
|
}
|
|
|
|
#region Classes for tests
|
|
public class MediaFactory1 : IMediaFactory
|
|
{
|
|
public List<string> Extensions
|
|
{
|
|
get { throw new NotImplementedException(); }
|
|
}
|
|
|
|
public int Priority
|
|
{
|
|
get { return 1; }
|
|
}
|
|
|
|
public bool CanHandleMedia(int parentNodeId, PostedMediaFile postedFile, User user)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public Media HandleMedia(int parentNodeId, PostedMediaFile postedFile, User user)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public Media HandleMedia(int parentNodeId, PostedMediaFile postedFile, User user, bool replaceExisting)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
|
|
public class MediaFactory2 : IMediaFactory
|
|
{
|
|
public List<string> Extensions
|
|
{
|
|
get { throw new NotImplementedException(); }
|
|
}
|
|
|
|
public int Priority
|
|
{
|
|
get { return 2; }
|
|
}
|
|
|
|
public bool CanHandleMedia(int parentNodeId, PostedMediaFile postedFile, User user)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public Media HandleMedia(int parentNodeId, PostedMediaFile postedFile, User user)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public Media HandleMedia(int parentNodeId, PostedMediaFile postedFile, User user, bool replaceExisting)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |