Skip to content

Interface events are not available unless type is casted to interface #148

Description

@harvinders

Imagine I have a type

public IExecutionProgress
{
        event EventHandler<TestExecutionStartedEventArgs> TestExecutionStarting;

        event EventHandler<TestExecutionStartedEventArgs> TestExecutionStarted;

        event EventHandler<TestExecutionCompletedEventArgs> TestExecutionCompleting;

        event EventHandler<TestExecutionCompletedEventArgs> TestExecutionCompleted;
}

public interface ITestExecutor : IExecutionProgress
{
}

public class Runner : ITestExecutor
{
}

Doing something like

var runner = new TestRunner();

runner.Events().TestExecutionStarting.Subscribe(x={}); // Compilation error Events() returns NullEvents

(runner as IExecutionProgress).Events().TestExecutionStarting.Subscribe(x={}); // This works

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions