|
In Zend, models are added to the view:
//In a controller public function indexAction() { //Do some work and get a model $this->view->model = $model; }
We can easily check that "model" exists in the view (I'm using simpletest for this):
//In a unit...
Started by Todd R on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Http://www.contentwithstyle.co.uk/content/unit-testing-controllers-with-zend-framework
So.
|
|
I'd like to write (in c#) a unit-test for an MVC controller action which might return one view or the other, depending on whether the request is authenticated. How can this be done?
Thanks in advance.
Started by Matthias on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Something like this ( Moq using):
var request = new Mock<HttpRequestBase>(); request.SetupGet(x => x.IsAuthenticated).Returns(true); // or false var context = new Mock<HttpContextBase>(); context.SetupGet(x =&... .
You can mock your Request.
|
|
When using Cruise Control to build an iPhone XCode project with Unit Tests, an error of "Code Sign error: a valid provisioning profile matching the application's Identifier 'com.yourcompany.Calculator' could not be found" is generated. This isn't encountered...
Started by jbjon on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
By default, it had assigned the Unit Test Bundle to be built against the....
IPhone (with the -target command line option)
The problem was caused by the addition of the Unit dragged the Unit Tests target into the main project Target.
|
Ask your Facebook Friends
|
I'm currently writing some methods that do some basic operations on form controls eg Textbox, Groupbox, these operations are generic and can be used in any application.
I started to write some unit tests and was just wondering should I use the real form...
Started by Nathan W on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
If it's the actual controls you're trying to unit test on System.....
If you're trying to unit test the application logic by simulating interaction with the UI controls the controller methods from your unit tests.
|
|
Some of my controller actions need to respond with different ViewResults depending whether or not they were called by an AJAX request. Currently, I'm using the IsAjaxRequest() method to check for this. When this method is called during a unit test, it...
Started by Kirschstein on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Find an answer to your question on this page: Unit Testing Ajax Actions in ASP.Net MVC Controllers.
|
|
I am just learning about Unit Testing. I am using NUnit to build tests for a VB.NET project.
The project I'm working on is part of a framework which will be used by people who build ASP.NET websites. It includes a base class (which inherits System.Web...
Started by Chris Roberts on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
[Test] public void TestExample() { // First, instantiate "Tester" objects: LabelTester label = new LabelTester("textLabel"); LinkButtonTester link = new LinkButtonTester("linkButton"); // Second, visit... .
It's no longer maintained but there is NUnitAsp.
|
|
Hi folks,
I'm doing some simple MS unit tests on my standard, nothing special controller.
When i check the ViewName proprty, from the returned ViewResult object, it's "" (empty).
I'm under the impression that the ViewName is implied by the name of the...
Started by Pure.Krome on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
We could also.
So our actions need to set the viewname explicitly when we unit test.
But when we unit test, we short-circuit the framework and there is nothing left to set the name.
By the framework.
|
|
If I create a test suite for a development project, should those classes be kept under version control with the rest of the project code?
Started by devonmallory on
, 15 posts
by 15 people.
Answer Snippets (Read the full thread at stackoverflow):
It's the classic who, where and why that is "watching" your source control you can have it run the latest unit tests on every commitYes, there is no reason not ....
In to source control still apply to any unit tests you write.
|
|
Has anyone been able to successfully unit test methods that are, by necessity, coupled to the System.Windows.Forms.Form class?
I've recently been working on a C# winforms application, trying to build it with an MVC structure. This is difficult enough,...
Started by Turbulent Intellect on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
You unit test the classes that provide the functionality, and then just tie your GUI events.
The best method I've heard of/used for unit testing with GUI elements is the Humble Dialog pattern.
|
|
Hi,
I'm just getting going with ASP.NET MVC and I'm also new to unit testing :) So far, so good.
I have a controller action that sets up an index view using a viewmodel. Testing the controller action is straight-forward as I can pass a fake service class...
Started by Nick on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Your implementation gives the user the option to flexibly create the... .
I would pass this in a code review with no problems .
Actually, this is a pattern that we use all the time in our public facing API's, and demonstrates good use of dependency injection .
|