本文整理汇总了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);
}
示例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 });
}
示例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();
}
示例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);
}
示例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 });
}