Rhino Mocks заглушка выражения

Я хотел бы заглушить метод со следующей подписью:

Product[] GetAllActive(Expression<Func<Product, bool>> predicate, bool asNoTracking = true, params Expression<Func<Product, object>>[] navigationProperties);

Я использую Rhino Mocks, любые идеи

Спасибо

1 ответ

Решение

Этот работал для меня:

productService.Stub(
            p =>
            p.GetAllActive(
                Arg<Expression<Func<Product, bool>>>.Is.Anything, 
                Arg<bool>.Is.Anything, 
                Arg<Expression<Func<Product, object>>>.Is.Anything)).Return(new[]
                   {
                       new Product
                           {
                               Id = 1, 
                               Name = "Special one", 
                               ShortDescription = "This is product one"
                           }, 
                       new Product
                           {
                               Id = 2, 
                               Name = "Special two", 
                               ShortDescription = "This is product two"
                           }
                   };);
Другие вопросы по тегам