当前位置: 首页>>代码示例>>C#>>正文


C# IUserService.Expect方法代码示例

本文整理汇总了C#中IUserService.Expect方法的典型用法代码示例。如果您正苦于以下问题:C# IUserService.Expect方法的具体用法?C# IUserService.Expect怎么用?C# IUserService.Expect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IUserService的用法示例。


在下文中一共展示了IUserService.Expect方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Setup

		public void Setup()
		{
			userService = MockRepository.GenerateStub<IUserService>();
			controller = new OrderStatusController(userService);

			userService.Expect(x => x.CurrentUser).Return(new User { Id = 4 });
		}
开发者ID:somlea-george,项目名称:sutekishop,代码行数:7,代码来源:OrderStatusControllerTests.cs

示例2: Setup

		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 });
		}
开发者ID:bertusmagnus,项目名称:Sutekishop,代码行数:28,代码来源:CheckoutControllerTester.cs

示例3: Setup

		public void Setup()
		{
			user = new User();
			userService = MockRepository.GenerateStub<IUserService>();
			userService.Expect(x => x.CurrentUser).Return(user);
			binder = new CurrentBasketBinder(userService);
		}
开发者ID:bertusmagnus,项目名称:Sutekishop,代码行数:7,代码来源:CurrentBasketBinderTester.cs

示例4: Setup

		public void Setup()
		{
			userService = MockRepository.GenerateStub<IUserService>();
			repository = MockRepository.GenerateStub<IRepository<Order>>();
			emailService = MockRepository.GenerateStub<IEmailService>();
			controller = new OrderStatusController(repository, userService, emailService);

			userService.Expect(x => x.CurrentUser).Return(new User() { UserId = 4 });
		}
开发者ID:bertusmagnus,项目名称:Sutekishop,代码行数:9,代码来源:OrderStatusControllerTests.cs

示例5: SetUp

        public void SetUp()
        {
            productRepository = MockRepository.GenerateStub<IRepository<Product>>();
            contentRepository = MockRepository.GenerateStub<IRepository<Content>>();
            userService = MockRepository.GenerateStub<IUserService>();

            siteMapController = new SiteMapController(productRepository, contentRepository, userService);

            userService.Expect(c => c.CurrentUser).Return(new User{ Role = Role.Guest });
        }
开发者ID:somlea-george,项目名称:sutekishop,代码行数:10,代码来源:SiteMapControllerTests.cs

示例6: Setup

		public void Setup()
		{
			user = new User { Role = Role.Administrator };
			
            userService = MockRepository.GenerateStub<IUserService>();
			userService.Expect(x => x.CurrentUser).Return(user);
		    
            basketService = MockRepository.GenerateStub<IBasketService>();
		    basketService.Stub(b => b.GetCurrentBasketForCurrentUser()).Return(new Basket());

			binder = new CurrentBasketBinder(userService, basketService);
		}
开发者ID:somlea-george,项目名称:sutekishop,代码行数:12,代码来源:CurrentBasketBinderTester.cs

示例7: SetUp

        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();
        }
开发者ID:bertusmagnus,项目名称:Sutekishop,代码行数:42,代码来源:OrderControllerTests.cs

示例8: SetUp

        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();

            MockRepository.GenerateStub<IRepository<ProductImage>>();

            MockRepository.GenerateStub<IHttpFileService>();
            sizeService = MockRepository.GenerateStub<ISizeService>();

            productOrderableService = MockRepository.GenerateStub<IOrderableService<Product>>();
            MockRepository.GenerateStub<IOrderableService<ProductImage>>();

        	userService = MockRepository.GenerateStub<IUserService>();

			productController = new ProductController(productRepository, categoryRepository, sizeService, productOrderableService, userService, MockRepository.GenerateStub<IUnitOfWorkManager>());

        	userService.Expect(c => c.CurrentUser).Return(new User { RoleId = Role.AdministratorId });
        }
开发者ID:bertusmagnus,项目名称:Sutekishop,代码行数:23,代码来源:ProductControllerTests.cs

示例9: InitializeTest

        public void InitializeTest()
        {
            UserPasswordService.PasswordResetTokenMinutesTimeout = 10;
            m_unitOfWork = new MemoryUnitOfWork();
            m_userService = MockRepository.GenerateMock<IUserService>();
            var tokenId = 0;
            m_tokenRepository = new MemoryRepository<UserPasswordResetToken>(m_unitOfWork, (o) => ++tokenId);
            var token = new UserPasswordResetToken() { Code = Guid.NewGuid(), UserId = 3 };
            m_tokenRepository.Add(token);

            var historyId = 0;
            m_historyRepository = new MemoryRepository<UserPasswordHistory>(m_unitOfWork, (o) => ++historyId);

            m_target = new UserPasswordService(m_tokenRepository, m_historyRepository, m_userService);

            m_userService.Expect(e => e.GetById(1)).Return(new User() { Id = 1, Password = m_target.Encrypt("11"), Email = "[email protected]" });
            m_userService.Expect(e => e.GetById(2)).Return(new User() { Id = 2, Password = m_target.Encrypt("22"), Email = "[email protected]" });
            m_userService.Expect(e => e.GetById(3)).Return(new User() { Id = 3, Password = m_target.Encrypt("33"), Email = "[email protected]" });

            m_userService.Expect(e => e.GetByEmail("test[email protected]")).Return(new User() { Id = 1, Password = m_target.Encrypt("11"), Email = "[email protected]" });
            m_userService.Expect(e => e.GetByEmail("[email protected]")).Return(new User() { Id = 2, Password = m_target.Encrypt("22"), Email = "[email protected]" });
            m_userService.Expect(e => e.GetByEmail("[email protected]")).Return(new User() { Id = 3, Password = m_target.Encrypt("33"), Email = "[email protected]" });

            m_unitOfWork.Commit();
        }
开发者ID:giacomelli,项目名称:SampleProject,代码行数:25,代码来源:UserPasswordServiceTest.cs


注:本文中的IUserService.Expect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。