This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product. Otherwise - post away!
I have just started using Lightspeed in ASP.NET MVC 3 environment. I have set for my controllers' base the LightspeedControllerBase class, as recommended in the manual. The application runs nicely, works everything as expected.
But when I'm trying to write any controller tests, even a simple one fails. A sample test using Moq:
It fails at the line Actionresult ar = hc.Test() with the message :
MyApplication.Tests.UnitTests.TestHomeController: System.MethodAccessException : Attempt by method 'MyApplication.Web.HomeController.Test()' to access method 'System.Web.Mvc.Controller.View()' failed.
If I change back the base controller to System.Web.Mvc.Controller, then the test runs fine. The references seems to be set up correctly.
So I have a bet that I'm not testing it correctly, or doing something wrong or insufficiently. Could you provide some instructions how to start testing these controllers?
Make sure the project containing your unit tests contains a binding redirect for Mvc. LightSpeed's Mvc extensions are compiled against MVC 2, so they need the binding redirect in place otherwise you see those MethodMissing type exceptions. The binding redirect is automatically added as part of the MVC project templates but you will need to add it manually for any other projects.
e.g. If you have your unit tests in a class library, create a new app.config and paste in: