Unit testing domain classes with Rhino Mocks

Thread is closed for posting
3 posts, 0 answers
  1. Peter
    Peter avatar
    2 posts
    Member since:
    May 2009

    Posted 02 Aug 2009 Link to this post

    I’ve also been using Rhino Mocks to avoid dependencies and focus on unit testing domain classes. Unfortunately, I’m a bit stuck when it comes to stubbing a [Persistent] class.

    For example, if you had:

    [Persistent] 
    public abstract class Person 
    … 

    Because it is abstract, it would be nice to call:

    MockRepository.GenerateStub<Person>() 
     

    but I always get a null reference exception relating to

    Telerik.OpenAccess.PersistentAttribute.get_IdentityClassName() 

    Any thoughts?
    (A work-around is to create a derived class without the [Persistent] property and stub that, but I don’t want to do that for every domain class!)

    Pete.

  2. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 05 Aug 2009 Link to this post

    Hi Peter,

    We have tried to use Telerik OpenAccess ORM with Rhino Mocks but with no luck so far. Unfortunately we cannot provide you with a solution at this stage. Maybe the only way is to use the workaround that you found. Our future plans are to provide a whole mocking solution that works with OpenAccess right out of the box. However the development has not started yet and we cannot give an exact time frame for this project.

    Greetings,
    Alexander
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Peter
    Peter avatar
    2 posts
    Member since:
    May 2009

    Posted 05 Aug 2009 Link to this post

    Ok, thanks Alexander.
Back to Top