-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
enhancementNew feature or requestNew feature or requestrule:compilationThis issue is related to a compilation rule.This issue is related to a compilation rule.
Milestone
Description
When calling the Raise() or RaiseAsync() method, check the parameters send to the events.
Category : Compilation
Level : Error
For example, the following code is invalid, because the TheEvent expected two arguments (object and string).
[Fact]
public void RaiseTest()
{
var mock = new Mock<IWithEvent>(MockBehavior.Strict);
mock.Raise(m => m.TheEvent += null, null, 1234);
}
public interface IWithEvent
{
event EventHandler<string> TheEvent;
}The following code is valid:
[Fact]
public void RaiseTest()
{
var mock = new Mock<IWithEvent>(MockBehavior.Strict);
mock.Raise(m => m.TheEvent += null, null, "1234");
}
public interface IWithEvent
{
event EventHandler<string> TheEvent;
}This rule will prevent the issue devlooped/moq#1568 (and the related PR devlooped/moq#1571).
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestrule:compilationThis issue is related to a compilation rule.This issue is related to a compilation rule.