public void BusinessListBaseFactory_Fetch_WithCriteria_ReturnsObject() { _criteria = MockRepository.GenerateStub<NHibernate.ICriteria>(); ProductList list = new ProductList(); list.Add(new Product() { Name = "Test" }); list.Add(new Product() { Name = "Test1" }); list.Add(new Product() { Name = "Test2" }); NHibernate.Criterion.SimpleExpression expression = Restrictions.Eq("Name", "Test"); _criteria.Expect(c => c.Add(expression)).Return(_criteria); _repository.Expect(r => r.CreateCriteria()).Return(_criteria); _criteria.Expect(c => c.List<Product>()).Return(list); ProductList products = _factory.Fetch(new SingleCriteria<ProductList, string>("Test")); _repository.AssertWasCalled(r => r.CreateCriteria()); _criteria.AssertWasCalled(c => c.List<Product>()); Assert.AreEqual(3, products.Count); }