2022-11-21 16:59:09 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace Tapeti.Tests.Mock
|
|
|
|
|
{
|
|
|
|
|
public class MockDependencyResolver : IDependencyResolver
|
|
|
|
|
{
|
|
|
|
|
private readonly Dictionary<Type, object> container = new();
|
|
|
|
|
|
|
|
|
|
|
2022-11-23 09:13:38 +01:00
|
|
|
|
public void Set<TInterface>(TInterface instance) where TInterface : class
|
2022-11-21 16:59:09 +01:00
|
|
|
|
{
|
|
|
|
|
container.Add(typeof(TInterface), instance);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public T Resolve<T>() where T : class
|
|
|
|
|
{
|
|
|
|
|
return (T)Resolve(typeof(T));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public object Resolve(Type type)
|
|
|
|
|
{
|
|
|
|
|
return container[type];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|