public void Setup()
		{
			products= new List<Product>();
			images = new List<Image>();
			validator = MockRepository.GenerateStub<IValidatingBinder>();
			repository = MockRepository.GenerateStub<IRepository<Product>>();
			repository.Expect(x => x.GetAll()).Return(products.AsQueryable());
			fileService = MockRepository.GenerateStub<IHttpFileService>();
			imageOrderableService = MockRepository.GenerateStub<IOrderableService<ProductImage>>();
			fileService.Expect(x => x.GetUploadedImages(null)).IgnoreArguments().Return(images);
			sizeService = MockRepository.GenerateStub<ISizeService>();
			
			var resolver = MockRepository.GenerateStub<IRepositoryResolver>();
			
			controllerContext = new ControllerContext()
			{
				HttpContext = MockRepository.GenerateStub<HttpContextBase>()
			};

			controllerContext.HttpContext.Stub(x => x.Request).Return(MockRepository.GenerateStub<HttpRequestBase>());
			sizeService.Expect(x => x.WithValues(controllerContext.HttpContext.Request.Form)).Return(sizeService);

			valueProvider = new FakeValueProvider();
			bindingContext = new ModelBindingContext() 
			{
				ModelState = new ModelStateDictionary(),
                ModelMetadata = ModelMetadataProviders.Current.GetMetadataForType(null, typeof(Product)),
				ModelName = "product",
				ValueProvider = valueProvider
			};

			binder = new ProductBinder(validator, resolver, repository, fileService, imageOrderableService, sizeService);
		}
		public MenuController(IRepository<Menu> menuRepository, IRepository<Category> categoryRepository,
		                      IOrderableService<Content> contentOrderableService)
		{
			this.menuRepository = menuRepository;
			this.contentOrderableService = contentOrderableService;
			this.categoryRepository = categoryRepository;
		}
 public ProductCopyService(
     IOrderableService<ProductCategory> productCategoryOrder, 
     IRepository<Product> productRepository)
 {
     this.productCategoryOrder = productCategoryOrder;
     this.productRepository = productRepository;
 }
		public void Setup()
		{
			menuRepository = MockRepository.GenerateStub<IRepository<Menu>>();
			orderableService = MockRepository.GenerateStub<IOrderableService<Content>>();
		    contentRepository = MockRepository.GenerateStub<IRepository<Content>>();
			controller = new MenuController(menuRepository, orderableService, contentRepository);
		}
Example #5
0
        protected override IProductBuilderContributor InitContributor()
        {
            httpFileService = MockRepository.GenerateStub<IHttpFileService>();
            productOrderableService = MockRepository.GenerateStub<IOrderableService<ProductImage>>();

            return new Images(httpFileService, productOrderableService);
        }
Example #6
0
 public Categories(
     IRepository <Category> categoryRepository,
     IOrderableService <ProductCategory> productCategoryOrderableService)
 {
     this.categoryRepository = categoryRepository;
     this.productCategoryOrderableService = productCategoryOrderableService;
 }
 public void Setup()
 {
     menuRepository    = MockRepository.GenerateStub <IRepository <Menu> >();
     orderableService  = MockRepository.GenerateStub <IOrderableService <Content> >();
     contentRepository = MockRepository.GenerateStub <IRepository <Content> >();
     controller        = new MenuController(menuRepository, orderableService, contentRepository);
 }
 public CategoryController(IRepository<Category> categoryRepository, IOrderableService<Category> orderableService, IHttpFileService httpFileService, IRepository<Image> imageRepository)
 {
     this.categoryRepository = categoryRepository;
 	this.imageRepository = imageRepository;
 	this.httpFileService = httpFileService;
 	this.orderableService = orderableService;
 }
Example #9
0
 public Categories(
     IRepository<Category> categoryRepository, 
     IOrderableService<ProductCategory> productCategoryOrderableService)
 {
     this.categoryRepository = categoryRepository;
     this.productCategoryOrderableService = productCategoryOrderableService;
 }
Example #10
0
 public CategoryController(IRepository <Category> categoryRepository, IOrderableService <Category> orderableService, IHttpFileService httpFileService, IRepository <Image> imageRepository)
 {
     this.categoryRepository = categoryRepository;
     this.imageRepository    = imageRepository;
     this.httpFileService    = httpFileService;
     this.orderableService   = orderableService;
 }
Example #11
0
        protected override IProductBuilderContributor InitContributor()
        {
            httpFileService         = MockRepository.GenerateStub <IHttpFileService>();
            productOrderableService = MockRepository.GenerateStub <IOrderableService <ProductImage> >();

            return(new Images(httpFileService, productOrderableService));
        }
Example #12
0
        protected override IProductBuilderContributor InitContributor()
        {
            categoryRepository = MockRepository.GenerateStub<IRepository<Category>>();
            productCategoryOrderableService = MockRepository.GenerateStub<IOrderableService<ProductCategory>>();

            return new Categories(categoryRepository, productCategoryOrderableService);
        }
Example #13
0
 public ProductCopyService(
     IOrderableService <ProductCategory> productCategoryOrder,
     IRepository <Product> productRepository)
 {
     this.productCategoryOrder = productCategoryOrder;
     this.productRepository    = productRepository;
 }
		public void Setup()
		{
			categoryRepository = MockRepositoryBuilder.CreateCategoryRepository();
			menuRepository = MockRepository.GenerateStub<IRepository<Menu>>();
			orderableService = MockRepository.GenerateStub<IOrderableService<Content>>();
			controller = new MenuController(menuRepository, categoryRepository, orderableService);
		}
Example #15
0
        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 });
        }
Example #16
0
		public ProductBinder(IValidatingBinder validatingBinder, IRepositoryResolver resolver, IRepository<Product> repository, IHttpFileService httpFileService, IOrderableService<ProductImage> orderableService, ISizeService sizeService)
			: base(validatingBinder, resolver)
		{
			this.repository = repository;
			this.httpFileService = httpFileService;
			this.orderableService = orderableService;
			this.sizeService = sizeService;
		}
Example #17
0
 public MenuController(
     IRepository <Menu> menuRepository,
     IOrderableService <Content> contentOrderableService,
     IRepository <Content> contentRepository)
 {
     this.menuRepository          = menuRepository;
     this.contentOrderableService = contentOrderableService;
     this.contentRepository       = contentRepository;
 }
		public ProductController(IRepository<Product> productRepository, IRepository<Category> categoryRepository, ISizeService sizeService, IOrderableService<Product> productOrderableService, IUserService userService, IUnitOfWorkManager uow)
		{
			this.productRepository = productRepository;
			this.uow = uow;
			this.userService = userService;
			this.categoryRepository = categoryRepository;
			this.sizeService = sizeService;
			this.productOrderableService = productOrderableService;
		}
Example #19
0
		public CmsController(
			IRepository<Content> contentRepository,
			IOrderableService<Content> contentOrderableService,
			IValidatingBinder validatingBinder)
		{
			this.contentRepository = contentRepository;
			this.contentOrderableService = contentOrderableService;
			this.validatingBinder = validatingBinder;
		}
Example #20
0
	    public CmsController(
            IRepository<Content> contentRepository,
            IRepository<Menu> menuRepository,
            IOrderableService<Content> contentOrderableService)
		{
			this.contentRepository = contentRepository;
	        this.menuRepository = menuRepository;
			this.contentOrderableService = contentOrderableService;
		}
Example #21
0
        public void SetUp()
        {
            DomainEvent.TurnOff();

            productCategoryOrderableService = MockRepository.GenerateStub <IOrderableService <ProductCategory> >();
            productRepository  = new FakeRepository <Product>();
            productCopyService = new ProductCopyService(productCategoryOrderableService, productRepository);

            originalCategory = new Category();
            originalProduct  = CreateProduct(originalCategory);
        }
        public void SetUp()
        {
            DomainEvent.TurnOff();

            productCategoryOrderableService = MockRepository.GenerateStub<IOrderableService<ProductCategory>>();
            productRepository = new FakeRepository<Product>();
            productCopyService = new ProductCopyService(productCategoryOrderableService, productRepository);

            originalCategory = new Category();
            originalProduct = CreateProduct(originalCategory);
        }
Example #23
0
 private void CreateServices()
 {
     var connectionStringProvider = new ConnectionStringProvider("Data Source=.\\SQLEXPRESS;Initial Catalog=JumpTheGun;Integrated Security=True");
     var dataContextProvider = new DataContextProvider(connectionStringProvider);
     this.contentRepository = new Repository<Content>(dataContextProvider);
     this.userRepository = new Repository<User>(dataContextProvider);
     var categoryRepository = new Repository<Suteki.Shop.Category>(dataContextProvider);
     this.contentOrderableService = new OrderableService<Content>(contentRepository);
     this.baseControllerService = new BaseControllerService(categoryRepository);
     this.imageFileService = new ImageFileService();
 }
Example #24
0
        private void CreateServices()
        {
            var iocContainer = GetIocContainer();

            contentRepository       = iocContainer.Resolve <IRepository <Content> >();
            menuRepository          = iocContainer.Resolve <IRepository <Menu> >();
            userRepository          = iocContainer.Resolve <IRepository <User> >();
            contentOrderableService = iocContainer.Resolve <IOrderableService <Content> >();
            baseControllerService   = iocContainer.Resolve <IBaseControllerService>();
            imageFileService        = iocContainer.Resolve <IImageFileService>();
            unitOfWorkManager       = iocContainer.Resolve <IUnitOfWorkManager>();
        }
Example #25
0
        private void CreateServices()
        {
            var iocContainer = GetIocContainer();

            contentRepository = iocContainer.Resolve<IRepository<Content>>();
            menuRepository = iocContainer.Resolve<IRepository<Menu>>();
            userRepository = iocContainer.Resolve<IRepository<User>>();
            contentOrderableService = iocContainer.Resolve<IOrderableService<Content>>();
            baseControllerService = iocContainer.Resolve<IBaseControllerService>();
            imageFileService = iocContainer.Resolve<IImageFileService>();
            unitOfWorkManager = iocContainer.Resolve<IUnitOfWorkManager>();
        }
        public void SetUp()
        {
            contentRepository = MockRepository.GenerateStub<IRepository<Content>>();
            contentOrderableService = MockRepository.GenerateStub<IOrderableService<Content>>();
            baseControllerService = MockRepository.GenerateStub<IBaseControllerService>();
            imageFileService = MockRepository.GenerateStub<IImageFileService>();
            userService = MockRepository.GenerateStub<IUserService>();

            metaWeblog = new MetaWeblogWcf(
                userService,
                contentRepository,
                baseControllerService,
                contentOrderableService,
                imageFileService);

            var url = "http://localhost:27198/MetaWeblogTest.svc";

            baseControllerService.Stub(s => s.SiteUrl).Return(theSiteUrl);
            userService.Stub(s => s.Authenticate(Arg<string>.Is.Anything, Arg<string>.Is.Anything)).Return(true);
            var user = new User
            {
                RoleId = Role.AdministratorId
            };
            userService.Stub(s => s.CurrentUser).Return(user);


            container = new WindsorContainer()
                .AddFacility<WcfFacility>(f => f.DefaultBinding = new XmlRpcHttpBinding())
                .Register(
                    Component.For<XmlRpcEndpointBehavior>(),
                    Component.For<IMetaWeblog>().Instance(metaWeblog)
                        .ActAs(new DefaultServiceModel()
                            .AddBaseAddresses(url)
                            .AddEndpoints(
                                WcfEndpoint.ForContract<IMetaWeblog>()
                            )

                        )
                    );

            //var targetUrl = url;
            var targetUrl = "http://ipv4.fiddler:27198/MetaWeblogTest.svc";
            var factory = new XmlRpcChannelFactory<IMetaWeblog>(new XmlRpcHttpBinding(), new EndpointAddress(targetUrl));
            client = factory.CreateChannel();

            // diagnostics
            var traceListener = new XmlWriterTraceListener("app_tracelog.svclog")
            {
                TraceOutputOptions = TraceOptions.Timestamp
            };
            Trace.Listeners.Add(traceListener);
        }
Example #27
0
 public MetaWeblogWcf(
     IUserService userService, 
     IRepository<Content> contentRepository, 
     IBaseControllerService baseControllerService, 
     IOrderableService<Content> contentOrderableService, 
     IImageFileService imageFileService)
 {
     this.userService = userService;
     this.imageFileService = imageFileService;
     this.contentOrderableService = contentOrderableService;
     this.baseControllerService = baseControllerService;
     this.contentRepository = contentRepository;
 }
Example #28
0
        public void SetUp()
        {
            categoryRepository = MockRepositoryBuilder.CreateCategoryRepository();
            orderableService   = MockRepository.GenerateStub <IOrderableService <Category> >();
            fileService        = MockRepository.GenerateStub <IHttpFileService>();
            imageRepository    = MockRepository.GenerateStub <IRepository <Image> >();

            categoryController = new CategoryController(
                categoryRepository,
                orderableService,
                fileService,
                imageRepository
                );
        }
        public void SetUp()
        {
            categoryRepository = MockRepositoryBuilder.CreateCategoryRepository();
            orderableService = MockRepository.GenerateStub<IOrderableService<Category>>();
			fileService = MockRepository.GenerateStub<IHttpFileService>();
			imageRepository = MockRepository.GenerateStub<IRepository<Image>>();

            categoryController = new CategoryController(
                categoryRepository, 
                orderableService, 
				fileService,
				imageRepository
                );
        }
        public void SetUp()
        {
            // you have to be an administrator to access the CMS controller
            Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("admin"), new string[] { "Administrator" });

            contentRepository = MockRepository.GenerateStub<IRepository<Content>>();
            contentOrderableService = MockRepository.GenerateStub<IOrderableService<Content>>();
            validatingBinder = new ValidatingBinder(new SimplePropertyBinder());

            cmsController = new CmsController(
                contentRepository, 
                contentOrderableService,
                validatingBinder);
        }
Example #31
0
        public void SetUp()
        {
            // you have to be an administrator to access the CMS controller
            Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("admin"), new[] { "Administrator" });

            contentRepository       = MockRepository.GenerateStub <IRepository <Content> >();
            menuRepository          = MockRepository.GenerateStub <IRepository <Menu> >();
            contentOrderableService = MockRepository.GenerateStub <IOrderableService <Content> >();

            cmsController = new CmsController(
                contentRepository,
                menuRepository,
                contentOrderableService);
        }
        public void SetUp()
        {
            // you have to be an administrator to access the CMS controller
            Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("admin"), new[] { "Administrator" });

            contentRepository = MockRepository.GenerateStub<IRepository<Content>>();
            menuRepository = MockRepository.GenerateStub<IRepository<Menu>>();
            contentOrderableService = MockRepository.GenerateStub<IOrderableService<Content>>();

            cmsController = new CmsController(
                contentRepository, 
                menuRepository,
                contentOrderableService);
        }
Example #33
0
 public ProductController(
     IRepository <Product> productRepository,
     IRepository <Category> categoryRepository,
     IOrderableService <Product> productOrderableService,
     IUserService userService,
     IUnitOfWorkManager uow,
     IProductBuilder productBuilder)
 {
     this.productRepository = productRepository;
     this.uow                     = uow;
     this.userService             = userService;
     this.categoryRepository      = categoryRepository;
     this.productOrderableService = productOrderableService;
     this.productBuilder          = productBuilder;
 }
Example #34
0
 public MetaWeblog(
     IRepository<Content> contentRepository,
     IRepository<Menu> menuRepository,
     IRepository<User> userRepository,
     IOrderableService<Content> contentOrderableService,
     IBaseControllerService baseControllerService,
     IImageFileService imageFileService)
 {
     this.contentRepository = contentRepository;
     this.menuRepository = menuRepository;
     this.userRepository = userRepository;
     this.contentOrderableService = contentOrderableService;
     this.baseControllerService = baseControllerService;
     this.imageFileService = imageFileService;
 }
		public ProductController(
            IRepository<Product> productRepository, 
            IRepository<Category> categoryRepository, 
            IOrderableService<ProductCategory> productOrderableService, 
            IUserService userService, 
            IUnitOfWorkManager uow,
            IProductBuilder productBuilder)
		{
			this.productRepository = productRepository;
			this.uow = uow;
			this.userService = userService;
			this.categoryRepository = categoryRepository;
			this.productOrderableService = productOrderableService;
		    this.productBuilder = productBuilder;
		}
Example #36
0
 public MetaWeblog(
     IRepository <Content> contentRepository,
     IRepository <Menu> menuRepository,
     IRepository <User> userRepository,
     IOrderableService <Content> contentOrderableService,
     IBaseControllerService baseControllerService,
     IImageFileService imageFileService)
 {
     this.contentRepository       = contentRepository;
     this.menuRepository          = menuRepository;
     this.userRepository          = userRepository;
     this.contentOrderableService = contentOrderableService;
     this.baseControllerService   = baseControllerService;
     this.imageFileService        = imageFileService;
 }
        public void SetUp()
        {
            // you have to be an administrator to access the CMS controller
            Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("admin"), new[] { "Administrator" });

            postageRepository = MockRepository.GenerateStub<IRepository<Postage>>();
            orderableService = MockRepository.GenerateStub<IOrderableService<Postage>>();
            httpContextService = MockRepository.GenerateStub<IHttpContextService>();

            postageController = new PostageController
            {
                Repository = postageRepository,
                OrderableService = orderableService,
                HttpContextService = httpContextService
            };
        }
Example #38
0
        public void SetUp()
        {
            // you have to be an administrator to access the CMS controller
            Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("admin"), new[] { "Administrator" });

            postageRepository  = MockRepository.GenerateStub <IRepository <Postage> >();
            orderableService   = MockRepository.GenerateStub <IOrderableService <Postage> >();
            httpContextService = MockRepository.GenerateStub <IHttpContextService>();

            postageController = new PostageController
            {
                Repository         = postageRepository,
                OrderableService   = orderableService,
                HttpContextService = httpContextService
            };
        }
		public ProductImageController(IOrderableService<ProductImage> productImageOrderableService,
		                              IRepository<ProductImage> productImageRepository)
		{
			this.productImageOrderableService = productImageOrderableService;
			this.productImageRepository = productImageRepository;
		}
 public void SetUp()
 {
     thingRepository = MockRepository.GenerateStub<IRepository<Thing>>();
     orderService = new OrderableService<Thing>(thingRepository);
 }
Example #41
0
 public Images(IHttpFileService httpFileService, IOrderableService <ProductImage> productOrderableService)
 {
     this.httpFileService         = httpFileService;
     this.productOrderableService = productOrderableService;
 }
Example #42
0
 protected override IProductBuilderContributor InitContributor()
 {
     productOrderableService = MockRepository.GenerateStub <IOrderableService <Product> >();
     return(new Position(productOrderableService));
 }
Example #43
0
 public Images(IHttpFileService httpFileService, IOrderableService<ProductImage> productOrderableService)
 {
     this.httpFileService = httpFileService;
     this.productOrderableService = productOrderableService;
 }
Example #44
0
 public Position(IOrderableService <Product> productOrderableService)
 {
     this.productOrderableService = productOrderableService;
 }
 public void SetUp()
 {
     thingRepository = MockRepository.GenerateStub <IRepository <Thing> >();
     orderService    = new OrderableService <Thing>(thingRepository);
 }
Example #46
0
 public ProductImageController(IOrderableService <ProductImage> productImageOrderableService,
                               IRepository <ProductImage> productImageRepository)
 {
     this.productImageOrderableService = productImageOrderableService;
     this.productImageRepository       = productImageRepository;
 }
Example #47
0
 public Position(IOrderableService<Product> productOrderableService)
 {
     this.productOrderableService = productOrderableService;
 }
Example #48
0
 protected override IProductBuilderContributor InitContributor()
 {
     productOrderableService = MockRepository.GenerateStub<IOrderableService<Product>>();
     return new Position(productOrderableService);
 }