public void TestInitialize() { factories = Substitute.For<Factories>(); fixture = new Fixture(); factories.Finder.Returns(new FinderImpl(factories)); factories.CreateCategory().Returns(new Category()); factories.Categories.Returns(fixture.CreateMany<Category>().ToList()); factories.Products.Returns(fixture.CreateMany<Product>(5).ToList()); foreach (var product in factories.Products) { product.CategoryId = factories.Categories[1].Id; product.SetOwner(factories); } factories.MruProducts.Returns(new MruProductsImpl(new List<Guid>(), factories)); factories.Settings.Returns(new Settings()); viewModel = new ProductListingViewModel(factories, new BackgroundWorkerSyncFactory()); }