This project is read-only.

Unit testing a custom driver in Orchard

Topics: Core, General, Troubleshooting
May 1, 2014 at 8:53 AM
Edited May 1, 2014 at 9:38 AM
Hi everybody,

I am a newbie in orchard framework. I am trying to write unit test cases for a custom driver in orchard.
I am using Moq and NUnit for unit testing. I need to pass parameters into the methods i.e. Display, Editor. These members are protected. I like to know the workaround to test these methods.
May 1, 2014 at 12:23 PM
Edited May 1, 2014 at 12:24 PM
Unit testing Orchard content-related components (drivers, handlers, content items) can be troublesome at times, hence we've built a testing helper library for those tasks - Proligence.Orchard.Testing.

Extension methods for calling driver methods sit in Proligence.Orchard.Testing.ContentPartDriverExtensions class.

Feel free to check it out and play with it - it's all MIT-licensed as the Orchard itself.
May 1, 2014 at 2:40 PM
Thanks man. Much obliged. I will dive into it.
Jul 9, 2014 at 9:12 PM
This looks like it could be really useful in addressing some of the issues we've been having unit testing with Orchard. Are there any examples of how to get started or use the library?