I didn't Mock it in the test I actually called it and it works fine.
The class is public, I went through and made sure everything was
public to eliminate that as a possiblity. I did leave off one extra
inner exception, I apologize here is the entire exception stack:
{"Activation error occured while trying to get instance of type
{IJobDal, key \"\""} inner exception of:
{"ComponentActivator: could not proxy TEAMSData.DALs.JobDal"} inner
exception of:
{"ComponentActivator: could not instantiate
uNhAddIns.SessionEasier.Conversations.NhConversationsContainerAccessor"}
with a message of:
"ComponentActivator: could not proxy TEAMSData.DALs.JobDal"
On Jun 25, 3:40 pm, Markus Zywitza <[email protected]> wrote:
> -Did you mock the IJobDal in the tests, so that the actual class was never
> tested?
> -Is the class internal or sealed?
>
> -Markus
>
> 2009/6/25 joshlrogers <[email protected]>
>
>
>
>
>
> > I am a beginner to both IoC and Castle.Windsor so please bear with me.
>
> > I am running some unit tests in which I call the servicelocator to get
> > an instance of an object:
>
> > IJobLogic jobLogic = ServiceLocator.Current.GetInstance<IJobLogic>();
>
> > I have initialized it here:
>
> > container.Register(Component.For<IJobLogic>()
> > .ImplementedBy<JobLogic>()
> > .LifeStyle.Transient);
>
> > The constructor of the class looks like such:
>
> > private IJobDal _JobDal;
>
> > public JobLogic(IJobDal jobDal)
> > {
> > _JobDal = jobDal;
> > }
>
> > IJobDal is registered to an implementation of JobDal. JobDal accepts
> > a IDaoFactory in its constructor which is also registered.
>
> > My problem is that that getting the instance of IJobLogic works in the
> > unit tests but when I try and do it through my main app I get this
> > Exception:
>
> > {"Activation error occured while trying to get instance of type
> > IJobLogic, key \"\""} the inner exception is:
>
> > {"ComponentActivator: could not proxy TEAMSData.DALs.JobDal"}
>
> > I have no idea why this works in one assembly and does not in the
> > other. I thought it would HAVE to be the references, but nope they
> > both have the exact same references.
>
> > Any guidance would be greatly appreciated.
>
> > Thanks in advance,
> > Josh- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---