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
This following test code fails:

public class StdMessage
  public virtual Uri Type
      return new Uri("http://Original.uri/bla");

public void TypeMockTest()
  StdMessage msg = new StdMessage();
  Uri uriRet = new Uri("http://mocked.uri/bla");
  using (RecordExpectations recorder = RecorderManager.StartRecording())
     // CAUTION: ALL calls here are mocked!!!
     Uri dummy = msg.Type;
  Uri value = msg.Type;

typemock throws the following exception:

Test method UnitTests.TypeMock.TypeMockTest threw exception: TypeMock.TypeMockException:
*** Cannot return a value for StdMessage.get_Type() because no value was set. use recorder.Return().
*** Note: Cannot mock types from mscorlib assembly..

clearly, i have called recoder.Return()...

if i change the property type from Uri to anything else (that i tried...) it works.
what's wrong with Uri ?
asked by mod (5.8k points)

2 Answers

0 votes

Ive checked this and indeed it looks like a bug on pour side
We shall fix it and let you know when it is solved.

:!: We have seen the problem happens only in VS 2008, if you are not using this version please let me know.
answered by lior (13.2k points)
0 votes
Yes, I am using VS 2008.
answered by mod (5.8k points)