This is a migrated thread and some comments may be shown as answers.

Unit testing domain classes with Rhino Mocks

2 Answers 72 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Peter
Top achievements
Rank 1
Peter asked on 03 Aug 2009, 01:33 AM

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 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 05 Aug 2009, 11:11 AM
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.
0
Peter
Top achievements
Rank 1
answered on 05 Aug 2009, 09:14 PM
Ok, thanks Alexander.
Tags
General Discussions
Asked by
Peter
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Peter
Top achievements
Rank 1
Share this question
or