Lea Hayes
Lea Hayes

Reputation: 64206

What is the correct name for interface with multiple callbacks?

Given the nature of the following, what is the best name for the interface? and if applicable which design pattern is this?

public interface ITestEvent??? {   // Handler / Listener / Observer / Emitter / ???

    void OnBeginTesting(ITestContext context);
    void OnException(Exception ex);
    void OnEndTesting();

}

public class MyTestEvent??? : ITestEvent { ... }

Tester.Add???(new MyTestEvent???());

Upvotes: 1

Views: 104

Answers (1)

Dave Clausen
Dave Clausen

Reputation: 1318

Initially I felt it was Command, where you're encapsulating a testing request, and invoking/queuing it with Tester.Add().

But after your feedback, I realize that you're simply passing-in behavior; so I agree with @kabram that this is Delegate.

Upvotes: 2

Related Questions