You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
504 B
19 lines
504 B
using Autofac;
|
|
|
|
namespace Recyclarr.TestLibrary.Autofac;
|
|
|
|
public static class AutofacTestExtensions
|
|
{
|
|
public static void RegisterMockFor<T>(this ContainerBuilder builder) where T : class
|
|
{
|
|
builder.RegisterInstance(Substitute.For<T>()).As<T>();
|
|
}
|
|
|
|
public static void RegisterMockFor<T>(this ContainerBuilder builder, Action<T> mockSetup) where T : class
|
|
{
|
|
var mock = Substitute.For<T>();
|
|
mockSetup(mock);
|
|
builder.RegisterInstance(mock).As<T>();
|
|
}
|
|
}
|