'Invalid callback. Setup on method with parameters (IRequest<Unit>, CancellationToken) cannot invoke callback with parameters

Ihave this model

 public class UpdateUserProfilCommand : IMapFrom<UserProfil>, IRequest<Unit>
{
    public Guid IdContact { get; set; }
    public Guid IdCompany { get; set; }
    public Guid IdApplication { get; set; }
    public Guid IdPrivilege { get; set; }
    public bool IsActif { get; set; }
    public Guid? CrmId { get; set; }
    public string Initiator { get; set; }

    public void Mapping(Profile profile)
    {
        profile.CreateMap<UpdateUserProfilCommand, UpdatedUserProfilCommand>();
        profile.CreateMap<UpdateUserProfilCommand, UserProfil>();
    }
}

this ligne of code

        _mediator.Setup(m => m.Send(It.IsAny<UpdateUserProfilCommand>(), It.IsAny<CancellationToken>()))
        .Callback<UpdateUserProfilCommand, CancellationToken>((request, cancellationToken) =>
        {
            _updateUserProfilHandler.Handle(request, cancellationToken);
        }
         );

      
        await _deleteUserProfilPrivilegesHandler.Handle(commandHandler, CancellationToken.None);
        var entities = _context.UserProfils.Where(x => x.IdContact == IdContact && x.IdCompany == IdCompany).ToList();

        // Assert
        if (entities.Count > 0)
        {
            Assert.Equal(entities.Count(x => x.IsActif == false), entities.Count);
        }

i have this issus Invalid callback. Setup on method with parameters (IRequest, CancellationToken) cannot invoke callback with parameters (UpdateUserProfilCommand,



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source