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


C# IUserService.Stub方法代码示例

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


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

示例1: SetUp

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

示例2: 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();

            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 });
        }
开发者ID:mikehadlow,项目名称:sutekishop,代码行数:25,代码来源:ProductControllerTests.cs

示例3: SetUp

        public void SetUp()
        {
            countryRepository = MockRepository.GenerateStub<IRepository<Country>>();
            userService = MockRepository.GenerateStub<IUserService>();
            basketService = new BasketService(countryRepository, userService);

            user = new User();
            userService.Stub(u => u.CurrentUser).Return(user).Repeat.Any();
        }
开发者ID:somlea-george,项目名称:sutekishop,代码行数:9,代码来源:BasketServiceTests.cs

示例4: SetUp

	    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);
	    }
开发者ID:sthapa123,项目名称:sutekishop,代码行数:16,代码来源:CheckoutServiceTester.cs

示例5: Setup

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

			userService = MockRepository.GenerateStub<IUserService>();
			orderRepository = new FakeRepository<Order>();
		    MockRepository.GenerateStub<IEncryptionService>();
		    checkoutService = MockRepository.GenerateStub<ICheckoutService>();

			controller = new CheckoutController(
				basketRepository,
				userService,
				orderRepository,
				unitOfWorkManager,
                checkoutService
			);

			userService.Stub(us => us.CurrentUser).Return(new User { Id = 4, Role = Role.Administrator });
		}
开发者ID:somlea-george,项目名称:sutekishop,代码行数:20,代码来源:CheckoutControllerTester.cs


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