This is a migrated thread and some comments may be shown as answers.

Tests failing when mocking a type same as the type under test

1 Answer 43 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Edoardo
Top achievements
Rank 1
Edoardo asked on 11 May 2012, 11:29 AM
Hi,

I'm using JustMock Q1 2012 SP1 (2012.1.508.6) and when I try to create a mock of the same type as the one under test most of the test for the type are failing.
 

A simplified example of what I'm doing follows.
var mock = Mock.Create<MyTypeUnderTest>(Constructor.Mocked);
var target = new MyTypeUnderTest ();
target.TestMethod();

The only temporary solution I've found is to create the Mock with Behavior.CallOriginal.

Any solution for this?

Kind Regards,
Edoardo

1 Answer, 1 is accepted

Sort by
0
Ricky
Telerik team
answered on 15 May 2012, 08:53 PM
Hi Edoardo,

Thanks again for contacting us. After investigating further, I found that it is an issue with JustMock and I included a task for it in PITS which you can follow here:

http://www.telerik.com/support/pits.aspx#/public/justmock/11109

It will be fixed in the coming release. In the meantime, you can just move the block to a different test method and it should work as expected:

var target = new MyTypeUnderTest ();
target.TestMethod();


Kind regards,
Ricky
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
General Discussions
Asked by
Edoardo
Top achievements
Rank 1
Answers by
Ricky
Telerik team
Share this question
or