<commit_before>///<reference path="../typings/tsd.d.ts" />
///<reference path="../source/interfaces.d.ts" />

import * as Stubs from './stubs';

import { Kernel, TypeBinding, TypeBindingScopeEnum, Inject } from "../source/inversify";
import { Lookup } from "../source/lookup";
import chai = require('chai');

var expect = chai.expect;

declare var Map;

//******************************************************************************
//* TYPE BINDING CLASS
//******************************************************************************
describe("Type Binding Class Test Suite \n", () => {

  it('It should set its own properties correctly \n', (done) => {

    var runtimeIdentifier = "FooInterface";
    var binding =  new TypeBinding<Stubs.FooInterface>(runtimeIdentifier, Stubs.Foo);
    expect(binding.runtimeIdentifier).to.equals(runtimeIdentifier);
    expect(binding.implementationType).to.not.equals(null);
    expect(binding.cache).to.equals(null);
    expect(binding.scope).to.equal(TypeBindingScopeEnum.Transient);

    var runtimeIdentifier = "BarInterface";
    var binding =  new TypeBinding<Stubs.BarInterface>(
      runtimeIdentifier, Stubs.Bar, TypeBindingScopeEnum.Singleton);

    expect(binding.runtimeIdentifier).to.equals(runtimeIdentifier);
    expect(binding.implementationType).to.not.equals(null);
    expect(binding.cache).to.equals(null);
    expect(binding.scope).to.equal(TypeBindingScopeEnum.Singleton);

    done();
  });

  it("It should be able to use implementationType as a constructor \n", (done) => {
    var runtimeIdentifier = "FooInterface";
    var binding =  new TypeBinding<Stubs.FooInterface>(runtimeIdentifier, Stubs.Foo);
    var instance = new binding.implementationType();
    expect(instance.greet()).to.equals("foo");
    done();
  });

  it("Throws when invalid scope \n", (done) => {
    var runtimeIdentifier = "FooInterface";
    var scopeType = 3;
    var fn = function() {
      new TypeBinding<Stubs.FooInterface>(runtimeIdentifier, Stubs.Foo, scopeType);
    }
    expect(fn).to.throw(`Invalid scope type ${scopeType}`);
    done();
  });

});

//******************************************************************************
//* KERNEL CLASS
//******************************************************************************
describe('Kernel Test Suite \n', () => {

  it('It should be able to resolve a service without dependencies \n', (done) => {
    var expected = new Stubs.Foo();
    var kernel = new Kernel();
    var runtimeIdentifier = "FooInterface";
    var binding =  new TypeBinding<Stubs.FooInterface>(runtimeIdentifier, Stubs.Foo);
    kernel.bind(binding);
    var result = kernel.resolve<Stubs.FooInterface>(runtimeIdentifier);
    expect(expected.name).to.equals(result.name);
    expect(expected.greet()).to.equals(result.greet());
    done();
  });

  it('It should be able to resolve a complex dependencies tree \n', (done) => {<commit_msg>Remove tests from main inversify test class<commit_after>///<reference path="../typings/tsd.d.ts" />
///<reference path="../source/interfaces.d.ts" />

import * as Stubs from './stubs';

import { Kernel, TypeBinding, TypeBindingScopeEnum, Inject } from "../source/inversify";
import { Lookup } from "../source/lookup";
import chai = require('chai');

var expect = chai.expect;

declare var Map;

//******************************************************************************
//* KERNEL CLASS
//******************************************************************************
describe('Kernel Test Suite \n', () => {

  it('It should be able to resolve a service without dependencies \n', (done) => {
    var expected = new Stubs.Foo();
    var kernel = new Kernel();
    var runtimeIdentifier = "FooInterface";
    var binding =  new TypeBinding<Stubs.FooInterface>(runtimeIdentifier, Stubs.Foo);
    kernel.bind(binding);
    var result = kernel.resolve<Stubs.FooInterface>(runtimeIdentifier);
    expect(expected.name).to.equals(result.name);
    expect(expected.greet()).to.equals(result.greet());
    done();
  });

  it('It should be able to resolve a complex dependencies tree \n', (done) => {
{'fraction_non_alphanumeric': 0.25036390101892286, 'fraction_numerical': 0.00024260067928190198, 'mean_word_length': 4.609523809523809, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7212079', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1081, 'n_words': 265}