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
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
I'm trying to call ExpectGet on a MockObject where the property returns a Nullable<Int32>.

However, I keep getting the error "TypeMock.TypeMockException:
*** No method get_PropertyTypeId in type MoneyPort.Core.PropertyType returns System.Int32." when I try and specify a value for the property to return.

What am I doing wrong?
asked by thepuffin (2.4k points)

3 Answers

0 votes
Interesting...

I can work around the problem by using a DynamicReturnValue instead!

propertyTypeMock.ExpectGet("PropertyTypeId", new DynamicReturnValue(delegate(object[] parameters, object context) { return new int?(PropertyTypeId); }));


Of course, this is pretty horrible code to write just for one int? :)
answered by thepuffin (2.4k points)
0 votes
Hi,
You are not doing anything wrong, you actually found a bug in TypeMock. :twisted:
You also found a cool 8) workaround.

:idea: We will create a fix for this soon.
answered by scott (32k points)
0 votes
Scott,

Many thanks for the fix you sent me offline.

I can confirm that the problem is now fixed. :D

Congratulations on having such amazing customer service!
answered by thepuffin (2.4k points)
...