2022-11-21 15:59:09 +00: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 08:13:38 +00:00
|
|
|
|
public void Set<TInterface>(TInterface instance) where TInterface : class
|
2022-11-21 15:59:09 +00: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];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|