Completed
Last Updated: 12 May 2022 07:53 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);
    }
}

 

 

 
3 comments
ADMIN
Mihail
Posted on: 12 May 2022 07:53

Hello,

The feature is implemented and available with R2 2022 version 2022.2.511.1

Regards,
Mihail
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

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?