You are currently viewing the BOOK: ASP.NET MVC 1.0 Test Driven Development Problem - Design - Solution section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
I have noticed that NInject didn't work from Unit Tests until well into Chapter 8, when the IoC bindings were created in the Test Fixture Setup.
Before that, the book directs us to use NInject, but the tests would fail because the objects that were supposed to be injected were null references. To make the tests pass, you have to pass the mock object via the constructor or setter property, which you shouldn't have to do because the whole point of an IoC container is to do that for you. So I thought maybe there was some problem with NInject . . .
It's pretty clear that the neither the author nor the editor have actually worked through the book, or they would have seen this right away. The material covered is great, so we'll just need to fill in the gaps with the errata and hope for a better 2nd edition . . .
Before we can start cranking out tests, we need to create a test class. Letís add a new test class for the
AccountController and name it AccountControllerTest. In order for it to be a test class, you deco-
rate it with MbUnitís [TestFixture] attribute. Here is the class:
Then, there is a convention box, which clearly states test classes should be named plural (Tests).
Makes you kinda wonder if these books are reviewed before they are published...
P.S. Topic starter might as well re-name this topic to 'Errata'