public void It_Disposes_Strategy_When_Disposed()
        {
            var isDisposed = false;

            var strategy = new TestCommandStrategy(onDispose: () => isDisposed = true);
            var command  = new DynamicCommand(DefaultCommandName, strategy);

            command.Dispose();

            isDisposed.Should().BeTrue();
        }
        public async Task It_Cancels_CancellationToken_When_Disposed()
        {
            var taskCompletionSource = new TaskCompletionSource <object>();

            var strategy = new TestCommandStrategy(
                onExecute: async(ct, _, __) =>
            {
                using (ct.Register(() => taskCompletionSource.TrySetCanceled()))
                {
                    await taskCompletionSource.Task;
                }
            }
                );

            var command = new DynamicCommand(DefaultCommandName, strategy);

            var commandExecution = command.Execute();

            command.Dispose();

            await commandExecution;

            taskCompletionSource.Task.IsCanceled.Should().BeTrue();
        }