Rhino подделывает выражения-заглушки

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

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

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

Спасибо


person Khasha    schedule 20.12.2012    source источник


Ответы (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"
                           }
                   };);
person Khasha    schedule 20.12.2012