views:

45

answers:

1

I've got a few questions related to the use of MonoRail

Testing

Does everyone tend to use NUnit for their testing? I haven't worked enough with testing to know if this is a good testing framework to use. I'm just looking to get more into testing my applications a lot more than before and wanted to know if there's any general guidelines.

Are you supposed to copy the controller over to a test area and just rename it with test in the name and re-run it? How do you ensure your test project and main project coincide with one another? Is it just a case of copying everything over again or are there tools available to do it for you?

Route Extensions

MonoRail tends to use <action>.rails, can you omit the .rails part if you configure your routing correctly? Why does this seem to be the standard?

Folder Structures

I haven't found anywhere which really points out your standard folder structure. Sure, you have Controllers, Models, and Views. But your Models folder should contain your data access objects as well. I've seen some have something like

-> Models
   -> DaoClasses
   -> Entities

But what about custom structures used to get data out of views? And if you're using NHibernate, where's a good place to stick the mappings? I know it's entirely dependent on the developer, but I haven't really seen any standard approach.

Cheers

+2  A: 

MonoRail doesn't enforce any particular testing framework. You can use NUnit, MsTest, MbUnit, xUnit, etc. You can't go wrong with NUnit. It seems that you need to familiarize yourself with unit testing, search for some introduction to the subject on the web. Basically, you create a test project with a reference to your actual project (never copy the code), and you code your tests against your actual code. For MonoRail-specific testing see this wiki page.

I'm not very familiar with MonoRail routing, but I think the .rails extension often shows up because extensionless routes were somewhat complicated on IIS6. On IIS7 this shouldn't be a problem. Also, the routing documentation uses .aspx as extension.

This is the standard folder structure for a MonoRail project.

A common approach to use NHibernate in a MonoRail app is to create a separate project for the NHibernate classes, then reference this project from the web project. Or you can just put everything together in the same project, but at least put the NHibernate entities in a separate namespace.

I strongly recommend taking a look at CastleCasts.com, it's an excellent resource to learn about MonoRail and its related projects.

Mauricio Scheffer