I am trying to mock the interface. The property I want to set to "MockThisProperty" has no setter. I cannot change the source of the interface. The error I get is this
Previous method 'IThirdPartyInterface.get_MockThisProperty ();' requires a return or exception for throw.
I tried DynamicMock, Strictmock, partial layout, etc.
When I try to execute SetupResult.For (thirdParty.MockThisProperty = mockedValue) will not compile because there is no setter.
using the latest nocturnal rhinos with mstest
In descending order, here is the code ...
var stuff = _Mockery.Stub<Hashtable>(); matchItem.Add(key, "Test"); var thirdParty = _Mockery.Stub<IThirdPartyInterface>(); SetupResult.For(thirdParty.MockThisProperty).Return(stuff); _Mockery.BackToRecordAll();
source share