public void SetUp() { // you have to be an administrator to access the product controller Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("admin"), new[] { "Administrator" }); categoryRepository = MockRepositoryBuilder.CreateCategoryRepository(); productRepository = MockRepositoryBuilder.CreateProductRepository(); productOrderableService = MockRepository.GenerateStub<IOrderableService<ProductCategory>>(); MockRepository.GenerateStub<IOrderableService<ProductImage>>(); userService = MockRepository.GenerateStub<IUserService>(); productBuilder = MockRepository.GenerateStub<IProductBuilder>(); productController = new ProductController( productRepository, categoryRepository, productOrderableService, userService, MockRepository.GenerateStub<IUnitOfWorkManager>(), productBuilder); userService.Stub(c => c.CurrentUser).Return(new User { Role = Role.Administrator }); }
public void Setup() { controller = new RichEditorController(MockRepositoryBuilder.CreateProductRepository(), MockRepositoryBuilder.CreateCategoryRepository(), MockRepositoryBuilder.CreateContentRepository()); }