Hello,
I have a WCF application and all objects are registered with a LifeStyle of
PerWCFOperation.
This works great in Production, and support all my concurrency needs.
The issue is I have Integration Tests that can no longer access the Service
classes, yielding an exception of:
Could not obtain scope for component "FooService". This is most likely
either a bug in custom IScopeAccessor or you're trying to access scoped
component outside of the scope (like a per-web-request component outside of
web request etc)
I'd rather not register my classes with a different LifeStyle for unit
tests, my DbContext is being shared by Repo's and a UoW object, and NUnit
runs the tests in parallel.
Right now, the base class does the access like so (this is the only place I
explicitly resolve in the entire app...in Production, everything is
constructor injection from the root of the application):
public class ServiceIntegrationTestBase<T> : ServiceIntegrationTestBase
{
protected T CUT;
[TestFixtureSetUp]
protected void Setup()
{
// Fails when executing this line:
CUT = IocContainer.Resolve<T>();
}
[TestFixtureTearDown]
protected void TearDown()
{
IocContainer.Release(CUT);
}
}
How do I access the WCF Service classes from my unit tests? I feel like I
need to get backed up to the DefaultServiceHostFactory, and simulate a WCF
call, but haven't been able to get it yet.
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.