Questions tagged [mvccontrib-testhelper]

42 questions
2
votes
0 answers

Using MVCContrib.TestHelpers with MsTest - is there any way to get nicer fail messages?

I'm just starting to use MVCContrib, and I'm really liking the syntactic sugar it adds to various test scenarious. For example, I just wrote this assertion: "~/".Route().ShouldMapTo(c => c.List()); It's brilliant! Well,…
Tomas Aschan
  • 58,548
  • 56
  • 243
  • 402
2
votes
2 answers

Newbie question on MvcContrib TestHelpers

I'm just starting to use the TestHelpers in MvcContrib. I want to try and test an action method on my controller that itself tests if IsAjaxRequest() is true. I've used the same code that is shown in the TestHelper samples to set up the…
Simon Lomax
  • 8,714
  • 8
  • 42
  • 75
1
vote
0 answers

Is this a bug in the MvcContrib TestHelper OutBoundUrl class?

I am trying to test the outbound URL of an action method in an MVC area using the MvcContrib TestHelper's static OutBoundUrl class. Here is what I have: OutBoundUrl.Of(action => action.NotFound()) …
1
vote
2 answers

T4MVC and testing with MvcContrib.TestHelpers issues with static linked content

I'm trying to write some tests around some code previously written before I start mucking with it. I'm running into issues where the controller method references some of the static variables that T4MVC makes for images and links. It is actually…
nportelli
  • 3,934
  • 7
  • 37
  • 52
1
vote
2 answers

Can I use Moq with MvcContrib.TestHelper?

I'm working on my first ASP .NET MVC project and prior to this moment I've only used Rhino.Mocks for desktop applications. It's been a while so I decided to find out what's used in the field now. After reading some praise for Moq, I decided to go…
Dan Abramov
  • 264,556
  • 84
  • 409
  • 511
1
vote
0 answers

How to verify the parameter of an action method with MVCContrib Route TestHelper

I have an action method which has pagination object as parameter public override ActionResult Index(Paging paging) { ....... return View(...); } So how could I verify the url to match action method and it's parameter? like…
Rajeesh
  • 4,377
  • 4
  • 26
  • 29
1
vote
2 answers

Attempted to read or write protected memory

I have a sample ASP.NET MVC 3 web application that is following Jonathan McCracken's Test-Drive Asp.NET MVC (great book , by the way) and I have stumbled upon a problem. Note that I'm using MVCContrib, Rhino and NUnit. [Test] public void…
Interfector
  • 1,868
  • 1
  • 23
  • 43
1
vote
2 answers

Missing Documentation: MVCContrib UI-Testing

Is there any documentation or example how to use MvcContrib.TestHelper.Ui and WatinDriver?
jbandi
  • 17,499
  • 9
  • 69
  • 81
1
vote
2 answers

Trying to stub Server.MapPath with MvcContrib Test helpers and Rhino Mocks 3.5

I'm using MvcContrib's test helpers and Rhino Mocks 3.5 to test an ASP.NET MVC action method. I build my fake controller like so: var _builder = new TestControllerBuilder(); _builder.InitializeController(_controller); So I get a fake controller…
Simon Lomax
  • 8,714
  • 8
  • 42
  • 75
1
vote
2 answers

Unit Testing UrlHelper Extension Methods

I'm trying to create unit tests to make sure my extension methods for UrlHelper work? Does anyone know how to do this? I'm using MVC 1.0 and MvcContrib. I can test the routes but can't test code like this: public static string…
fregas
  • 3,192
  • 3
  • 25
  • 41
1
vote
1 answer

Making mvccontrib testhelper work with actions that get route data automapped to objects

This is ASP.NET MVC v1 (not using the v2 yet) I have a route entry like this: routes.MapRoute( "Srp", "soeg-{searchQuery}/{listingType}", new { controller = "Srp", action = "Search", listingType =…
Per Hornshøj-Schierbeck
  • 15,097
  • 21
  • 80
  • 101
1
vote
1 answer

Setting Response.StatusCode using MvcContrib.TestHelpher

I've got a very simple test method, using MvcContrib.TestBuilder to setup the controller (and mock the HttpContext etc...) [Test] public void http404_returns_status_code_of_404() { var builder = new TestControllerBuilder(); …
Alex
  • 37,502
  • 51
  • 204
  • 332
1
vote
1 answer

tests failing when "Run All Test in Solution" is used

I am trying to get unit tests to run successfully for my MVC 4 Web Application project. When I run the tests classes individually all of the tests pass, when I come to run all test in solution only 2/9 pass, I have clicked Debug Checked Tests and…
CryoFusion87
  • 796
  • 1
  • 8
  • 28
1
vote
2 answers

How to test that an MVC action is only accessible via HTTP POST?

I am using MvcContrib-TestHelper to test the routing on my app. I have an action which is restricted to HTTP POST only: public TestController { [HttpPost] public ActionResult Example() { return View(); } } And here is an…
1
vote
1 answer

MVCContrib TestHelper and User.Identity.Name, Server.MapPath and Form Collection

I am new to MVCContrib Testhelper and mocking with Rhino. I am needing assistance with unit testing a controller which relies on User.Identity.Name, Server.MapPath and Form Collection. I started off with var controller = new SubmitController(); var…
MrMVCMan
  • 490
  • 2
  • 7
  • 20