I have used this DistinctBy method with that difference that i'm not using it as an extension. Now i want to write an unit test for another method that is calling this one, so i want to setup the return.
The "DistinctBy" Metod
public IEnumerable<TSource> DistinctBy<TSource, TKey>(
      IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
{
    HashSet<TKey> seenKeys = new HashSet<TKey>();
    foreach (TSource element in source)
    {
        if (seenKeys.Add(keySelector(element)))
        {
            yield return element;
        }
    }
}
The Initial Setup For now i have something like this(I'm using Autofac's Moq, Automock functionality):
List<Product> listProduct = new List<Product>{ product1, product2 };
mock.Mock<IHelpers>()
    .Setup(r => r.DistinctBy<List<BeautyBoutiqueArticle>, int>(It.IsAny<List<BeautyBoutiqueArticle>>(), It.IsAny<Func<List<BeautyBoutiqueArticle>, int>>()))
    .Returns(ieList)
    .Verifiable();
But it's not working. It's displaying errors like:
The best overloaded method match for.... has some illegal arguments, and/or Argument 1: cannot convert from 'System.Collections.Generic.List' to 'System.Collections.Generic.IEnumerable>'
 
     
    