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
The following code:

public interface ITestClass
{
    BindingSource BindingSourceTest { get; }
}

[Test]
public void testBindingSource()
{
    ITestClass tc = RecorderManager.CreateMockedObject<ITestClass>();
    using (RecordExpectations recorder = RecorderManager.StartRecording())
    {
        recorder.ExpectAndReturn(tc.BindingSourceTest, new BindingSource());
    }
}


produces the following exception:

TypeMock.TypeMockException:
*** Cannot return a value for MockITestClass.get_BindingSourceTest() because no value was set. use recorder.Return().
*** Note: Cannot mock types from mscorlib assembly.


I am using Visual Studio 2005.

Also, it seems that my (newly purchased) license wants to expire 8 days from now under 2.4.1 Beta. Is this due to the fact that it is still beta and you plan on releasing another version (beta or release) within that time frame? Thanks!
asked by jrob (640 points)

4 Answers

0 votes
Hi,

Thanks for reporting this. We'll get back to you first thing next week when we're back at the office. The code should not throw this, unless there's something special about BindingSource.

The notification you see is because you are using the Beta version. Once we release the 4.2 version (obviously before the beta expires :) ) you'll get back to the original license you have purchased.

Best regards.
answered by gilz (14.5k points)
0 votes
Hi,

We have cheked it out and indeed it seems that you have found a defect. :(
Ill let you know as soon as it is fixed.
answered by lior (13.2k points)
0 votes
I just wanted to let you know that I have recreated the problem with 4.2.2. Also, here is a revised test that passes with 4.1 and fails with 4.2. The other version does not pass on 4.2 because it's incomplete.


public interface ITestClass
{
    BindingSource BindingSourceTest { get; }
}

[Test]
public void testBindingSource()
{
    ITestClass tc = RecorderManager.CreateMockedObject<ITestClass>();
    using (RecordExpectations recorder = RecorderManager.StartRecording())
    {
        recorder.ExpectAndReturn(tc.BindingSourceTest, new BindingSource());
    }
    Assert.IsInstanceOfType(typeof(BindingSource), tc.BindingSourceTest);
}
answered by jrob (640 points)
0 votes
Hi
Thanks for the info.
Until it's fixed you can use the following work around:
[Test]
public void testBindingSource()
{
   ITestClass tc = RecorderManager.CreateMockedObject<ITestClass>();
   BindingSource ret = new BindingSource();
   using (RecordExpectations recorder = RecorderManager.StartRecording())
   {
      recorder.ExpectAndReturn(tc.BindingSourceTest, ret);
   }
   Assert.IsInstanceOfType(typeof (BindingSource), tc.BindingSourceTest);
}


Hope it helps.
answered by ohad (35.4k points)
...