-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Hi, I enjoyed your old blog post about this stuff. Pretty much the same stuff that I run except I use xUnit instead of Nunit.
Do you have an updated BaseTest for newer versions of Unity?
I ran into obsoleted code and in trying to create a resettable factory I keep getting invalid cast errors. I can't seem to get my
protected void RegisterResettableType<T>(Func<Action<Mock<T>>> onCreatedCallbackFactory) where T : class
{
Container.RegisterFactory<T>(c => CreateMockInstance(onCreatedCallbackFactory), new ResettableFactoryLifetimeManager(Resetter));
//RegisterResettableType<T>(new InjectionFactory(c => CreateMockInstance(onCreatedCallbackFactory)));
}
So my ResettableFactoryLifetimeManager is this
protected class ResettableFactoryLifetimeManager : IFactoryLifetimeManager
{
private readonly LifetimeResetter _lifetimeResetter;
public ResettableFactoryLifetimeManager(LifetimeResetter lifetimeResetter)
{
_lifetimeResetter = lifetimeResetter;
}
public LifetimeManager CreateLifetimePolicy()
{
return new FactoryResettableManager(_lifetimeResetter);
}
}
I'm not sure what my FactoryResettableManager should be. I created a class that inherited LifetimeManager but I get an invalid cast when calling RegisterResettableType.
Any help would be great. Thanks.
Metadata
Metadata
Assignees
Labels
No labels