ninject / Ninject.MockingKernel

Extension for Ninject aiding testability in Moq, NSubstitute, and FakeItEasy
http://ninject.org/
Other
62 stars 25 forks source link

sourcecode example contains an error #12

Closed RoSchvisual4 closed 11 years ago

RoSchvisual4 commented 11 years ago

[SetUp] public void SetUp() { this.kernel.Reset(); this.kernel.Bind().To(); }

If you do it like this ninject will throw an error which states "multiple bindings are available. make sure you declared your bindings only once".

This happens when you run more than one testcase, because SetUp method will be called before EVERY test.

Best Regards Robert Schadt

fabian-we commented 11 years ago

Yes, you are right. Of course you could have fixed that directly by yourself - it's a wiki after all :-)

It's fixed now.

RoSchvisual4 commented 11 years ago

Hello fawei, sorry for that! We have our git servers running inhouse, so i never get too deep into github structure and possibilities. Next time i will fix it by myself.

In addition, i have tested your library yesterday and it is really great so far, thank you! Just one thing, some things are a bit tricky for starters and would be much easier if there would be some better documentation. Like when classes get mocked and when not, things like that. Of course it’s not too hard to find out yourself but i think for a starter it would be much easier with some documentation on that subject.

Anyway, it’s a wiki so i can write some stuff on my own, right? ;)

Best Regards Robert

Von: fawei [mailto:notifications@github.com] Gesendet: Donnerstag, 10. Januar 2013 17:55 An: ninject/ninject.mockingkernel Cc: Robert Schadt Betreff: Re: [ninject.mockingkernel] sourcecode example contains an error (#12)

Yes, you are right. Of course you could have fixed that directly by yourself - it's a wiki after all :-)

It's fixed now.

— Reply to this email directly or view it on GitHubhttps://github.com/ninject/ninject.mockingkernel/issues/12#issuecomment-12106502.

fabian-we commented 11 years ago

Just to get things straight, I'm not the developer of this project! All praise belongs to remogloor :) I just added the example to the wiki, because I also found it a bit hard to get started without an example.

If the description in the wiki ist still unclear, please expand it. One simple rule would be, that interfaces/classes with a normal binding are never mocked. Only if you didn't define a binding or explicitly defined a mock binding, ninject will give you mocked instances.