public void Setup()
		{
			basketRepository = MockRepository.GenerateStub<IRepository<Basket>>();
			unitOfWorkManager = MockRepository.GenerateStub<IUnitOfWorkManager>();

			userService = MockRepository.GenerateStub<IUserService>();
			postageService = MockRepository.GenerateStub<IPostageService>();
			countryRepository = MockRepository.GenerateStub<IRepository<Country>>();
			cardTypeRepository = MockRepository.GenerateStub<IRepository<CardType>>();
			orderRepository = MockRepository.GenerateStub<IRepository<Order>>();
			subscriptionRepository = MockRepository.GenerateStub<IRepository<MailingListSubscription>>();
			emailService = MockRepository.GenerateStub<IEmailService>();

			var mocks = new MockRepository(); //TODO: No need to partial mock once email sending is fixed
			controller = new CheckoutController(
				basketRepository,
				userService,
				postageService,
				countryRepository,
				cardTypeRepository,
				orderRepository,
				unitOfWorkManager,
				emailService,
				subscriptionRepository
			);
			mocks.ReplayAll();
			userService.Expect(us => us.CurrentUser).Return(new User { UserId = 4, RoleId = Role.AdministratorId });
		}
        public void SetUp()
        {
            basketRepository = MockRepository.GenerateStub<IRepository<Basket>>();
            postageService = MockRepository.GenerateStub<IPostageService>();

            postageDetailController = new PostageDetailController(basketRepository, postageService);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public ExchangeController(IExchangeService exchangeService, IMemberService memberService, IMailingAddressService mailingAddressService, IPostageService postageService)
 {
     _exchangeService       = exchangeService;
     _memberService         = memberService;
     _mailingAddressService = mailingAddressService;
     _postageService        = postageService;
 }
Exemplo n.º 4
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public ExchangeEventController(IExchangeService exchangeService, IMemberService memberService, IExchangeEventService exchangeEventService, IPostageService postageService)
 {
     _exchangeService      = exchangeService;
     _memberService        = memberService;
     _exchangeEventService = exchangeEventService;
     _postageService       = postageService;
 }
        public void SetUp()
        {
            basketRepository = MockRepository.GenerateStub <IRepository <Basket> >();
            postageService   = MockRepository.GenerateStub <IPostageService>();

            postageDetailController = new PostageDetailController(basketRepository, postageService);
        }
Exemplo n.º 6
0
 	public BasketController(IRepository<BasketItem> basketItemRepository, IRepository<Size> sizeRepository, IUserService userService, IPostageService postageService, IRepository<Country> countryRepository)
     {
 		this.basketItemRepository = basketItemRepository;
         this.sizeRepository = sizeRepository;
         this.userService = userService;
         this.postageService = postageService;
         this.countryRepository = countryRepository;
     }
        public void SetUp()
        {
            postageRepository = MockRepository.GenerateMock<IRepository<Postage>>();

            postageService = new PostageService(postageRepository);

            var postages = PostageTests.CreatePostages();
            postageRepository.Stub(pr => pr.GetAll()).Return(postages);
        }
Exemplo n.º 8
0
        public void SetUp()
        {
            postageRepository = MockRepository.GenerateMock <IRepository <Postage> >();

            postageService = new PostageService(postageRepository);

            var postages = PostageTests.CreatePostages();

            postageRepository.Stub(pr => pr.GetAll()).Return(postages);
        }
Exemplo n.º 9
0
        public CheckoutService(
            IRepository<Basket> basketRepository, 
            IEncryptionService encryptionService, 
            IPostageService postageService, 
            IUserService userService)
	    {
	        this.basketRepository = basketRepository;
	        this.postageService = postageService;
	        this.userService = userService;
	        this.encryptionService = encryptionService;
	    }
Exemplo n.º 10
0
 public CheckoutService(
     IRepository <Basket> basketRepository,
     IEncryptionService encryptionService,
     IPostageService postageService,
     IUserService userService)
 {
     this.basketRepository  = basketRepository;
     this.postageService    = postageService;
     this.userService       = userService;
     this.encryptionService = encryptionService;
 }
Exemplo n.º 11
0
		public CheckoutController(IRepository<Basket> basketRepository, IUserService userService, IPostageService postageService, IRepository<Country> countryRepository, IRepository<CardType> cardTypeRepository, IRepository<Order> orderRepository, IUnitOfWorkManager unitOfWork, IEmailService emailService, IRepository<MailingListSubscription> mailingListRepository)
		{
			this.basketRepository = basketRepository;
			this.emailService = emailService;
			this.mailingListRepository = mailingListRepository;
			this.unitOfWork = unitOfWork;
			this.orderRepository = orderRepository;
			this.cardTypeRepository = cardTypeRepository;
			this.countryRepository = countryRepository;
			this.postageService = postageService;
			this.userService = userService;
		}
Exemplo n.º 12
0
	    public void SetUp()
	    {
            basketRepository = MockRepository.GenerateStub<IRepository<Basket>>();
            encryptionService = MockRepository.GenerateStub<IEncryptionService>();
	        postageService = MockRepository.GenerateStub<IPostageService>();
	        userService = MockRepository.GenerateStub<IUserService>();

            checkoutService = new CheckoutService(basketRepository, encryptionService, postageService, userService);

            checkoutViewData = GetCheckoutViewData();
            basket = CreateBasketWithId(7);
            basketRepository.Stub(r => r.GetById(7)).Return(basket);

            user = new User { Role = Role.Administrator };
	        userService.Stub(u => u.CurrentUser).Return(user);
	    }
Exemplo n.º 13
0
        public OrderController(
			IRepository<Order> orderRepository, 
			IRepository<Country> countryRepository, 
			IRepository<CardType> cardTypeRepository, 
			IEncryptionService encryptionService, 
			IPostageService postageService, 
			IUserService userService, IOrderSearchService searchService, IRepository<OrderStatus> statusRepository)
        {
            this.orderRepository = orderRepository;
        	this.statusRepository = statusRepository;
        	this.searchService = searchService;
        	this.userService = userService;
        	this.countryRepository = countryRepository;
            this.cardTypeRepository = cardTypeRepository;
            this.encryptionService = encryptionService;
        	this.postageService = postageService;
        }
Exemplo n.º 14
0
        public void SetUp()
        {
            basketRepository  = MockRepository.GenerateStub <IRepository <Basket> >();
            encryptionService = MockRepository.GenerateStub <IEncryptionService>();
            postageService    = MockRepository.GenerateStub <IPostageService>();
            userService       = MockRepository.GenerateStub <IUserService>();

            checkoutService = new CheckoutService(basketRepository, encryptionService, postageService, userService);

            checkoutViewData = GetCheckoutViewData();
            basket           = CreateBasketWithId(7);
            basketRepository.Stub(r => r.GetById(7)).Return(basket);

            user = new User {
                Role = Role.Administrator
            };
            userService.Stub(u => u.CurrentUser).Return(user);
        }
Exemplo n.º 15
0
        public void SetUp()
        {
            // you have to be an administrator to access the order controller
            Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("admin"), new[] { "Administrator" });

            orderRepository = MockRepository.GenerateStub<IRepository<Order>>();
            countryRepository = MockRepository.GenerateStub<IRepository<Country>>();
            cardTypeRepository = MockRepository.GenerateStub<IRepository<CardType>>();
			

            encryptionService = MockRepository.GenerateStub<IEncryptionService>();
            postageService = MockRepository.GenerateStub<IPostageService>();
            userService = MockRepository.GenerateStub<IUserService>();
			searchService = MockRepository.GenerateStub<IOrderSearchService>();

            var mocks = new MockRepository();
    		statusRepository = MockRepository.GenerateStub<IRepository<OrderStatus>>();
    		orderController = new OrderController(
                orderRepository,
                countryRepository,
                cardTypeRepository,
                encryptionService,
                postageService,
                userService,
				searchService,
				statusRepository
				);

            testContext = new ControllerTestContext(orderController);

            postageService.Expect(ps => ps.CalculatePostageFor(Arg<Order>.Is.Anything));

            userService.Expect(us => us.CurrentUser).Return(new User { UserId = 4, RoleId = Role.AdministratorId });

            testContext.TestContext.Context.User = new User { UserId = 4 };
            testContext.TestContext.Request.RequestType = "GET";
            testContext.TestContext.Request.Stub(r => r.QueryString).Return(new NameValueCollection());
            testContext.TestContext.Request.Stub(r => r.Form).Return(new NameValueCollection());
			statusRepository.Expect(x => x.GetAll()).Return(new List<OrderStatus>().AsQueryable());

            mocks.ReplayAll();
        }
 public PostageDetailController(IRepository<Basket> basketRepository, IPostageService postageService)
 {
     this.basketRepository = basketRepository;
     this.postageService = postageService;
 }
Exemplo n.º 17
0
		public InvoiceController(IRepository<Order> orderRepository, IPostageService postageService)
		{
			this.orderRepository = orderRepository;
			this.postageService = postageService;
		}
		public void Setup()
		{
			repository = MockRepository.GenerateStub<IRepository<Order>>();
			postageService = MockRepository.GenerateStub<IPostageService>();
			controller = new InvoiceController(repository, postageService);
		}
Exemplo n.º 19
0
 public SnailMailOrderService(IPostageService PostageService)
 {
     postageService = PostageService;
 }
Exemplo n.º 20
0
 public PostageDetailController(IRepository <Basket> basketRepository, IPostageService postageService)
 {
     this.basketRepository = basketRepository;
     this.postageService   = postageService;
 }