I don't think so in this instance, because the resolve is called
against the mocked inner container (ILifetimeScope); although I am
happy to be proven wrong.
My instinct was to use Owned<ILifetimeScope> which would give me
control over the lifetime's creation and disposal.
However, when I invoke this I am unsure what ILifetimeScope I will
receive. So then I thought maybe I could register ILifetimeScope as
builder.Register(c =>
c.Resolve<IContainer>.BeginLifetimeScope()).As<ILifetimeScope>().InstancePerDependancy();
At this point I began cowering in fear and reverted to the foetal
position.
It might work yet. Spike in progress.
On Sep 20, 2:01 pm, Paul Stovell <
p...@paulstovell.com> wrote:
> Is it possible to avoid calling .Resolve and inject an Owned<T>/Func<T>
> instead?
>
> Paul
>
> On Mon, Sep 20, 2010 at 1:53 PM, Steven Burman <
steven.bur...@gmail.com>wrote:
>
>
>
> > I am currently in the process of upgrading our application from
> > Autofac 1.x to 2.x and I have cleared most of the little hurdles I
> > came across.
>
> > However, one remaining issue has me beat.
>
> > In some existing tests we mock the process of creating an inner
> > container scope and then mock out some calls to the Resolve method.
> > These tests passed successfully previously.
>
> > My guess (could be totally wrong) is whilst the exposed api did not
> > change, the Resolve method is now an extension method which means I
> > now have the task of delving into the source code so I can mock the
> > 'actual' calls to Resolve on my inner container.
>
> > Just wondering if this is the right path to go down? Have others
> > complained of this change? Or is it just me :(
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Autofac" group.
> > To post to this group, send email to
aut...@googlegroups.com.
> > To unsubscribe from this group, send email to
> >
autofac+u...@googlegroups.com<
autofac%2Bunsu...@googlegroups.com>
> > .