Mock - ObjectResult <>

2 posts, 0 answers
  1. centuit
    centuit avatar
    6 posts
    Member since:
    Aug 2011

    Posted 30 Aug 2011 Link to this post

    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
  2. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 05 Sep 2011 Link to this post

    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 >>

  3. DevCraft R3 2016 release webinar banner
Back to Top