in

CodePrairie .NET

South Dakota .NET User Group

chrisortman

Testing Helpers in MonoRail

I have a helper that generates some links and wanted to be able to test that functionality. The difficult thing is that the helper delgates to UrlHelper which Delegates to Controller and to UrlBuilder.

Thanks to the new testing functionality in MonoRail this was quite easy

Heres's part of my test fixture.

 

[TestFixture]
public class NavigationHelperFixtures : Castle.MonoRail.TestSupport.BaseControllerTest {
	private NavigationHelper helper;
	private TestController controller;
	[SetUp]
	public void Setup() {			
		helper = new NavigationHelper();
		controller = new TestController();
		PrepareController(controller, "test", "index");
		helper.SetController(controller);
	}
}
 

This will let me call my helper methods that call UrlHelper without problems.

 

 

Technorati tags: ,
Published Oct 24 2007, 10:44 PM by chrisortman
Filed under:

Comments

No Comments

Leave a Comment

(required)
(optional)
(required)
Add
Powered by Community Server (Commercial Edition), by Telligent Systems