Completed
Last Updated: 13 Aug 2024 14:52 by ADMIN
Ivo
Created on: 26 Jun 2024 07:32
Type: Bug Report
0
Raise Async Event causes Method Signature Error

Having the simple class

public class MyClass
{
    public event Func<EventArgs, Task>? MyEventAsync;
}
and the test that tries to rise the declared event
[TestMethod]
public void TestMethod1()
{
    var mockClass = Mock.Create<MyClass>(Behavior.Strict);
    mockClass.MyEventAsync += (args) => Task.CompletedTask;

    Mock.Raise(() => mockClass.MyEventAsync += null, EventArgs.Empty);
}

Execution triggers the following error:

Telerik.JustMock.Core.MockException : Event signature System.Threading.Tasks.Task OnMyEventAsync(System.EventArgs) is incompatible with argument types (Castle.Proxies.ExternalMockMixinProxy, System.EventArgs)

which is kind of unexpected since the supplied arguments are matching to the event's signature.

 

1 comment
ADMIN
Ivo
Posted on: 13 Aug 2024 14:52

The issue is fixed in 2024 Q3 release. Enjoy!

 

Regards,
Ivo
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.