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

Mock - ObjectResult <>

1 Answer 59 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
centuit
Top achievements
Rank 1
centuit asked on 30 Aug 2011, 02:25 PM
Hello,

I downloaded your trial version to mock Entity Framework. Our model contains Function Imports (Stored Procedures) that return an generic object called ObjectResul. This object is a sealed with a internal constructor that contains internal objects as paramters. When I try to Mock this object I get using the folloing line of code :

var tmock = Mock.Create<ObjectResult<GetMedicationPlural_Result>>();

I get the following error:

Constructor on type 'System.Data.Objects.ObjectResult`1[[Mdrx.Note.Data.GetMedicationPlural_Result, NoteServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' not found.

Any suggestions ?

Thanks

1 Answer, 1 is accepted

Sort by
0
Ricky
Telerik team
answered on 05 Sep 2011, 11:10 AM
Hi Centuit,

Thanks again for sending the issue. In this regard you can use the Constructor.Mocked switch. Since, ObjectResult has checks inside its constructor for not null arguments therefore even you were able to create the instance it would throw null reference exception.

 
But yes, I also found that there was an issue resolving the constructor for ObjectResult and fixed that. If you require that fix, please open a support ticket (since i can't send you an internal build in forum post) and we will send you an internal build as soon as possible.


Kind Regards,
Mehfuz.
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
General Discussions
Asked by
centuit
Top achievements
Rank 1
Answers by
Ricky
Telerik team
Share this question
or