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

2 posts, 0 answers
  1. Edoardo
    Edoardo avatar
    5 posts
    Member since:
    Mar 2011

    Posted 11 May 2012 Link to this post


    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 ();

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

    Any solution for this?

    Kind Regards,
  2. Ricky
    Ricky avatar
    467 posts

    Posted 15 May 2012 Link to this post

    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:


    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 ();

    Kind regards,
    the Telerik team

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

Back to Top