예제 #1
0
파일: ContextBase.cs 프로젝트: linn/stores
        public void EstablishContext()
        {
            this.TpkFacadeService = Substitute
                                    .For <ITpkFacadeService>();

            this.TransferableStockRepository = Substitute
                                               .For <IQueryRepository <TransferableStock> >();

            this.DomainService = Substitute.For <ITpkService>();

            var bootstrapper = new ConfigurableBootstrapper(
                with =>
            {
                with.Dependency(this.TpkFacadeService);
                with.Dependency(this.TransferableStockRepository);
                with.Dependency(this.DomainService);
                with.Dependency <IResourceBuilder <TransferableStock> >(new TransferableStockResourceBuilder());
                with.Dependency <IResourceBuilder <IEnumerable <TransferableStock> > >(new TransferableStockListResourceBuilder());
                with.Dependency <IResourceBuilder <TpkResult> >(new TpkResultResourceBuilder());
                with.Module <TpkModule>();
                with.ResponseProcessor <TransferableStockListResponseProcessor>();
                with.ResponseProcessor <TpkResultsResponseProcessor>();
                with.RequestStartup(
                    (container, pipelines, context) =>
                {
                    var claims = new List <Claim>
                    {
                        new Claim(ClaimTypes.Role, "employee"),
                        new Claim(ClaimTypes.NameIdentifier, "test-user")
                    };
                    var user = new ClaimsIdentity(claims, "jwt");

                    context.CurrentUser = new ClaimsPrincipal(user);
                });
            });

            this.Browser = new Browser(bootstrapper);
        }
예제 #2
0
 public TpkFacadeService(IQueryRepository <TransferableStock> repository, ITpkService domainService)
 {
     this.repository    = repository;
     this.domainService = domainService;
 }