Planned
Last Updated: 19 Oct 2021 10:31 by ADMIN
Ivo
Created on: 18 Sep 2020 14:23
Type: Feature Request
2
Mock interfaces with default implementations

C# 8 introduces default interface method implementations. Attempt to mock such methods with JustMock in elevated mode fails. The following example illustrates the issue:

public interface IMyInterface
{
    int IntProperty { get => 0; }
}


[TestClass]
public class UnitTest1
{
    [TestMethod]
    public void TestMethod1()
    {
        var mock = Mock.Create<IMyInterface>();
        Mock.Arrange(() => mock.IntProperty).Returns(1);

        Assert.AreEqual(1, mock.IntProperty);
    }
}

 

 

 
2 comments
ADMIN
Mihail
Posted on: 19 Oct 2021 10:31

Hi Benjamin,

The feature is scheduled for R1 2022 expected in mid-January. I hope this timeframe is suitable for you.

Regards,
Mihail
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

jh-bkraemer
Posted on: 15 Oct 2021 12:36
This is currently creating problems for us, since we try to mock code that we don't have access to and which is using default implementations. Any timeline on this?