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.
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
So my
ResettableFactoryLifetimeManageris thisI'm not sure what my
FactoryResettableManagershould be. I created a class that inheritedLifetimeManagerbut I get an invalid cast when callingRegisterResettableType.Any help would be great. Thanks.