public void TestInitialize() { this.parentCategory = TestData.Categories.CreateCategories(); this.displayCategory = this.parentCategory.ChildCategories[2]; this.productRepository = new Mock <IProductRepository>(); this.productRepository.SetupGetCategoryById(this.parentCategory); this.viewModel.ProductRepository = this.productRepository.Object; this.viewModel.ParentCategoryId = this.parentCategory.Id; this.viewModel.DisplayCategoryId = this.displayCategory.Id; IoC.GetInstance = IoCHelper.GetInstanceFromFactory(CreateMockedProductsByCategoryViewModel); }