Last Updated: 16 Jan 2019 08:59 by ADMIN
Created on: 18 Sep 2018 08:53
Type: Bug Report
Mock assert doesn't fail when there are multiple mocks with occurrence expectations that are not satisfied
If there are more that one mock objects existing in the test, Mock.Assert wrongly succeeds while evaluating arrangements for each mock, but not the very first one. This is a regression compared to an older version from 2012. The following sample demonstrates the case:
public interface IFoo
    void Bar();

public class UnitTest1
    public void TestMethod1()
        var bar = Mock.Create<IFoo>();
        Mock.Arrange(() => bar.Bar()).OccursOnce();

        var foo = Mock.Create<IFoo>();
        Mock.Arrange(() => foo.Bar()).OccursOnce();

        Mock.Assert(foo); // Would wrongly succeed
        Mock.Assert(bar); // Would fail as expected
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
1 comment
Posted on: 16 Jan 2019 08:59

The problem is fixed and will be included in R1 2019 Release.

Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items