私は 1 つの責任を持つ CommandController クラスを持っており、CommandService に Module コマンドを提供します。実装を非表示にするために、クラスはコマンドを登録し、実装にプライベート メソッドを含めます。次のようになります。
internal class CommandController
{
private ICommandService commandService;
public void RegisterCommands()
{
this.commandService.Register("ExampleCommand", this.ExecuteExampleCommand);
}
private void ExecuteExampleCommand()
{
... implementation here ...
}
}
一度に複数のクラスをテストしないように、ICommandService をモックする単体テストで ExecuteExampleCommand をテストするにはどうすればよいですか (とにかく、サービスが UT 環境に登録されていない可能性があります)。
質問が十分に明確であることを願っています。