//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace MUnique.OpenMU.Tests;
using Moq;
using MUnique.OpenMU.GameLogic.Views;
using MUnique.OpenMU.PlugIns;
///
/// A view plugin container which automatically create mocks for requested view plugins.
///
public class MockViewPlugInContainer : ICustomPlugInContainer
{
private readonly Dictionary _mocks = new();
///
public T GetPlugIn()
where T : class, IViewPlugIn
{
if (!this._mocks.TryGetValue(typeof(T), out var mock))
{
mock = new Mock().Object;
this._mocks.Add(typeof(T), mock);
}
return (T)mock;
}
}