Completed
Last Updated: 16 Jan 2019 08:59 by ADMIN
ADMIN
Ivo
Created on: 18 Sep 2018 08:53
Type: Bug Report
0
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();
}

[TestClass]
public class UnitTest1
{
    [TestMethod]
    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
    }
}
1 comment
ADMIN
Mihail
Posted on: 16 Jan 2019 08:59
Hello,

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

Regards,
Mihail
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