chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
I am trying to mock a Commerce Server Product so that I can pass it to a method that I am testing. I get an error when I use the following code.

MockObject MockProduct = MockManager.MockObject<Product>();

The error I get is

system.MethodAccessException : Microsoft.CommerceServer.Catalog.Product..ctor(Microsoft.CommerceServer.Catalog.ProductInfo) at Mock0000Product..ctor(ProductInfo )

I get the same error if I use

MockObject MockProduct = MockManager.MockObject<Product>(Constructor.Mocked);

Can anyone help me with this please?
asked by gbarrs (1.1k points)

2 Answers

0 votes

A MethodAccess exception is rare. Let's take it offline. I'll send a description of what we need in order to explore it further.

answered by gilz (14.5k points)
0 votes

We have investigated this issue and it seems that the problem originate from calling a private copy c'tor to create the Mocked Product.

Currently Our support team is working on a solution for this issue.
answered by dhelper (11.9k points)