Home > Magiq, NHibernate > Magiq-to-NHibernate: Testing for different mapping strategies

Magiq-to-NHibernate: Testing for different mapping strategies

Magiq has a set of tests for each operation (insert, update, delete and query) that should work for any provider, besides the spescific tests that could be wrote for each provider. The problem I faced when testing nhibernate was how to test several mapping strategies with the same test cases.
The good news is it’s very easy with NUnit 🙂
NUnit fully supports parameterized tests, for test cases and fixtures. Using the Parameterized Test Fixtures feature in NUnit 2.5 I created a mapping folder for each strategy to test and added the folder name as a fest fixture parameter. That’s how the test looks likie:

[TestFixture("subclass")]
[TestFixture("joined-subclass")]
public class MagiqToNHibernateInsertsInheritanceTest {
    //..
}

I love NUnit!

  1. mal
    November 13, 2010 at 6:31 am

    Hey will you continue working on Magiq? You know EF 4.0 is already and I well uh… could use your project. I think it’s brilliant and fantastic btw, and should have been a standard feature…

    • ivowiblo
      November 13, 2010 at 3:38 pm

      I should… It’s fully working for linq-to-sql and I started with NHibernate and things got complicated, because it has a lot of more features. But yeah, I should. You can help if you want 😉

  1. No trackbacks yet.

Leave a comment