Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
harvinders opened this issue Oct 6, 2022 · 0 comments
Open

Comments

@harvinders
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant