//
// FakeCommandHandler.cs
//
// Copyright (c) František Boháček. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Threading;
using System.Threading.Tasks;
using NosSmooth.Core.Commands;
using Remora.Results;
namespace NosSmooth.Core.Tests.Fakes.Commands;
///
public class FakeCommandHandler : ICommandHandler
{
private readonly Func _handler;
///
/// Initializes a new instance of the class.
///
/// The handler.
public FakeCommandHandler(Func handler)
{
_handler = handler;
}
///
public Task HandleCommand(FakeCommand command, CancellationToken ct = default)
=> Task.FromResult(_handler(command));
}