//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace MUnique.OpenMU.PlugIns.Tests;
///
/// A test implementation of a .
///
public class CustomTestPlugInContainer : CustomPlugInContainerBase
{
///
/// Initializes a new instance of the class.
///
/// The plugin manager which manages this instance.
public CustomTestPlugInContainer(PlugInManager manager)
: base(manager)
{
this.Initialize();
}
///
/// Gets or sets a value indicating whether this instance creates new plug ins in .
///
public bool CreateNewPlugIns { get; set; } = true;
///
protected override void CreatePlugInIfSuitable(Type plugInType)
{
if (this.CreateNewPlugIns)
{
this.AddPlugIn((ITestCustomPlugIn)Activator.CreateInstance(plugInType)!, true);
}
}
///
protected override ICustomTestPlugInContainer? DetermineEffectivePlugIn(Type interfaceType)
{
return this.ActivePlugIns.FirstOrDefault(interfaceType.IsInstanceOfType);
}
///
protected override bool IsNewPlugInReplacingOld(ICustomTestPlugInContainer currentEffectivePlugIn, ICustomTestPlugInContainer activatedPlugIn)
{
return true;
}
}