VerificationException ShouldMapTo: type argument violates constraint TController

251 views
Skip to first unread message

Steve

unread,
Oct 19, 2009, 5:21:50 AM10/19/09
to mvccontrib-discuss
Hi there. I've just belatedly started trying to get my head around
Unit Tests, and wanted to use ShouldMapTo for outbound routing tests.

I'm getting the following message though:
System.Security.VerificationException: Method
MvcContrib.TestHelper.RouteTestingExtensions.ShouldMapTo: type
argument 'GPv3mvc.Controllers.LatestController' violates the
constraint of type parameter 'TController'.

My test is:
[Test]
public void
All_Headlines_Page_1_Is_At_Slash_Latest_Slash_Headlines()
{
"~/Latest/Headlines".ShouldMapTo<LatestController>(x =>
x.Headlines(string.Empty, 1));
}

My LatestController is derived from MasterPageController, which is my
own implementation but which in turn derives from Controller. This
seemed like the obvious problem, but if I change LatestController to
derive directly from Controller I get the same error.

I'm wondering if I'm missing something obvious, or if this is an MVC 2
Preview 2 issue (which is what I'm using). I've downloaded the latest
MVCContrib RC to see if it helped, but it hasn't.

Sorry if this has been covered before, but some Googling hasn't found
any other mention.

Jeremy Skinner

unread,
Oct 19, 2009, 5:29:45 AM10/19/09
to mvccontri...@googlegroups.com
The RC build of MvcContrib is not compatible with MVC2 - you'll need to use the MVC2 preview branch.

You can get the MVC2-compatible sources from http://github.com/mvccontrib/MvcContrib/tree/mvc2 or the the pre-built binaries from the build server at http://teamcity.codebetter.com/viewType.html?buildTypeId=bt83&tab=buildTypeStatusDiv&guest=1 under "Artifacts"

Jeremy

2009/10/19 Steve <gamesp...@googlemail.com>

Steve

unread,
Oct 19, 2009, 9:30:01 AM10/19/09
to mvccontrib-discuss
Thank you! I'm in business.

On Oct 19, 10:29 am, Jeremy Skinner <jer...@jeremyskinner.co.uk>
wrote:
> The RC build of MvcContrib is not compatible with MVC2 - you'll need to use
> the MVC2 preview branch.
>
> You can get the MVC2-compatible sources fromhttp://github.com/mvccontrib/MvcContrib/tree/mvc2or the the pre-built
> binaries from the build server athttp://teamcity.codebetter.com/viewType.html?buildTypeId=bt83&tab=bui...
> "Artifacts"
>
> Jeremy
>
> 2009/10/19 Steve <gamespress...@googlemail.com>
Reply all
Reply to author
Forward
0 new messages