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


TypeScript inversify.Container类代码示例

本文整理汇总了TypeScript中inversify.Container的典型用法代码示例。如果您正苦于以下问题:TypeScript Container类的具体用法?TypeScript Container怎么用?TypeScript Container使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: beforeEach

 beforeEach(() => {
   container = new Container();
   container
     .bind<SettingsServiceAttributes>(registry.SettingsService)
     .to(MockSettingsService)
     .inSingletonScope();
   container
     .bind<interfaces.Factory<winston.LoggerInstance>>(registry.LoggerFactory)
     .toFactory(loggerFactory);
 });
开发者ID:patrickhousley,项目名称:xyzzy-mean,代码行数:10,代码来源:logger.spec.ts

示例2: beforeEach

  beforeEach(() => {
    sandbox      = sinon.createSandbox();
    container = createContainer();
    container.rebind(Symbols.modules.fork).to(ForkModule);
    block = createFakeBlock();
    instance     = container.get(Symbols.modules.fork);
    loggerStub   = container.get(Symbols.helpers.logger);
    socketIOStub = container.get(Symbols.generic.socketIO);
    forksModel = container.get(Symbols.models.forkStats);

  });
开发者ID:RiseVision,项目名称:rise-node,代码行数:11,代码来源:fork.spec.ts

示例3: it

    it("Should be able to auto-wire binding declarations", () => {

        let container = new Container();
        // Note @inject annotations are required autoProvide
        // even when using classes are used as identifiers
        // See declaration of Warrior for more details
        autoProvide(container, entites);
        container.load(buildProviderModule());
        let warrior = container.get(entites.Warrior);
        expect(warrior.fight()).eql("Using Katana...");

    });
开发者ID:inversify,项目名称:inversify-binding-decorators,代码行数:12,代码来源:auto_wire.test.ts

示例4: beforeAll

  beforeAll(() => {
    const container = new Container();
    const i18n = setupI18n();
    i18n._ = (id: string) => id;
    container.bind(TYPES.I18n).toConstantValue(i18n);
    container.bind(NotificationServiceType).toConstantValue(mockNS);
    loadNotifications(container);

    notifications = container.get<UIUpdateNotifications>(
      UIUpdateNotificationsType
    );
  });
开发者ID:dcos,项目名称:dcos-ui,代码行数:12,代码来源:notifications-test.ts

示例5: beforeEach

  beforeEach(() => {
    delete process.env.NODE_ENV;
    delete process.env.TEST_LOGGING;
    delete process.env.LOG_LEVEL;
    delete process.env.DATABASE_URL;
    delete process.env.PORT;

    container = new Container();
    container
      .bind<SettingsServiceAttributes>(registry.SettingsService)
      .to(SettingsService);
  });
开发者ID:patrickhousley,项目名称:xyzzy-mean,代码行数:12,代码来源:Settings.spec.ts

示例6: beforeEach

 beforeEach(() => {
   container = createContainer();
   container.bind(Symbols.api.utils.errorHandler).to(APIErrorHandler);
   sandbox = sinon.createSandbox();
   sendSpy = {send: sandbox.spy()};
   response = {status: () => sendSpy, send: sendSpy.send };
   responseStatusSpy = sandbox.spy(response, 'status');
   request = {url: {startsWith: sandbox.stub().callsFake((start) => !(start === '/v2') ) }};
   requestStub = request.url.startsWith;
   next = sandbox.spy();
   loggerStub = container.get(Symbols.helpers.logger);
   instance = container.get(Symbols.api.utils.errorHandler);
 });
开发者ID:RiseVision,项目名称:rise-node,代码行数:13,代码来源:errorHandler.spec.ts

示例7: Container

(async () => {

    const port = 3000;
    const container = new Container();
    await container.loadAsync(bindings);
    const app = new InversifyExpressServer(container);
    const server = app.build();
    
    server.listen(port, () => {
        console.log(`Server running at http://127.0.0.1:${port}/`)
    });

})();
开发者ID:inversify,项目名称:inversify-express-example,代码行数:13,代码来源:index.ts

示例8: beforeEach

 beforeEach(() => {
   sandbox = sinon.createSandbox();
   container = createContainer();
   loggerStub = container.get(Symbols.helpers.logger);
   peerLogicStub = new PeerLogicStub();
   systemModuleStub = container.get(Symbols.modules.system);
   peersFactoryStub = sandbox.stub().returns(peerLogicStub);
   instance = new PeersLogic();
   (instance as any).config = container.get(Symbols.generic.appConfig);
   (instance as any).logger = loggerStub;
   (instance as any).peersFactory = peersFactoryStub;
   (instance as any).systemModule = systemModuleStub;
 });
开发者ID:RiseVision,项目名称:rise-node,代码行数:13,代码来源:peers.spec.ts

示例9: beforeAll

    beforeAll(async () => {
        knex = Knex(DEFAULT_DB_CONFIG);
        await knex.migrate.latest();
        await knex.seed.run();

        const dbConfig = new DbConfig(DEFAULT_DB_CONFIG);
        container = new Container();

        container.bind<DbConfig>('DefaultDbConfig').toConstantValue(dbConfig);

        // container...
        container.bind<ICounterRepository>(TYPES.ICounterRepository).to(CounterRepository);

    });
开发者ID:baotaizhang,项目名称:fullstack-pro,代码行数:14,代码来源:counter-repository.test.ts

示例10: beforeEach

 beforeEach(() => {
   container.rebind(Symbols.helpers.slots).to(Slots);
   realSlots = container.get(Symbols.helpers.slots);
   (inst as any).slots = {
     getSlotNumber: realSlots.getSlotNumber,
     interval: (realSlots as any).interval,
   };
   lastBlk = { timestamp: constants.blockTime };
   blk = { timestamp: constants.blockTime * 2 };
 });
开发者ID:RiseVision,项目名称:rise-node,代码行数:10,代码来源:verify.spec.ts


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