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

Mocking troubles

3 Answers 29 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sergii
Top achievements
Rank 1
Sergii asked on 27 May 2013, 04:52 PM
HI,

I tried to create mock of difficult custom type, but I always have an exception like
System.TypeLoadException: System.TypeLoadException: Method 'UnloadRecursive' on type 'BaseProxy+...' from assembly 'Telerik.JustMock.Dynamic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is overriding a method that is not visible from that assembly..

I tried to use attribute InternalsVisibleTo like <Assembly: InternalsVisibleTo("Telerik.JustMock.Dynamic")> but it didn't solve the problem. I tried to create mock of parent types, all fine. I tried to use MockingContainer, but this no matter, because our type haven't external dependencies. I can't to find where the problem.

What you can to suggest me?


Thanks

3 Answers, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 28 May 2013, 08:53 AM
Hi Sergii,

Thank you for contacting Telerik support.

To mock non-public members, you may need to add InternalsVisibleTo attribute as follows:
  • For projects different from Silverlight:
    [assembly: InternalsVisibleTo("Telerik.JustMock, PublicKey=0024000004800000940000000602000000240000525341310004000001000100098b1434e598c6" +
    "56b22eb59000b0bf73310cb8488a6b63db1d35457f2f939f927414921a769821f371c31a8c1d4b" +
    "73f8e934e2a0769de4d874e0a517d3d7b9c36cd0ffcea2142f60974c6eb00801de4543ef7e93f7" +
    "9687b040d967bb6bd55ca093711b013967a096d524a9cadf94e3b748ebdae7947ea6de6622eabf" +
    "6548448e")]
  • For Silverlight projects:
    [assembly: InternalsVisibleTo("Telerik.JustMock")]

Please, contact us further if you need more assistance.

Regards,
Kaloyan
Telerik
Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums, or our JustTrace or JustMock portals.
0
Sergii
Top achievements
Rank 1
answered on 28 May 2013, 02:31 PM
Hi Kaloyan,

Unfortunately your advice didn't help me. But after update of JustMock all work well.
Thanks
0
Kaloyan
Telerik team
answered on 28 May 2013, 02:34 PM
Hi again Sergii,

It is good to hear your issue is solved now.

Please, do not hesitate to contact us again if you need help with anything else.

Regards,
Kaloyan
Telerik
Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums, or our JustTrace or JustMock portals.
Tags
General Discussions
Asked by
Sergii
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Sergii
Top achievements
Rank 1
Share this question
or