예제 #1
0
        public void CanLoadFromAssembly()
        {
            var kernel = KernelEx.Create();

            kernel.Load(typeof(SomeModule).Assembly);
            FinalModuleTests(kernel);
        }
예제 #2
0
 public void CanLoadParallelAssemblies()
 {
     RunTestFewTimes(() =>
     {
         var kernel = KernelEx.Create();
         kernel.LoadParallel(new[] { typeof(SomeModule).Assembly });
         FinalModuleTests(kernel);
     }, 100);
 }
예제 #3
0
        static string GetShortPath(string path)
        {
            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                return(QuoteFileName(path));
            }
            var shortPath = KernelEx.GetShortPathName(Path.GetDirectoryName(path));

            return(Path.Combine(shortPath, Path.GetFileName(path)));
        }
예제 #4
0
        public void CanLoadTwoModules()
        {
            var kernel = KernelEx.Create();

            kernel.Load(new SomeModule(), new SomeModule2());
            FinalModuleTests(kernel);
            var reverseKernel = KernelEx.Create();

            reverseKernel.Load(new SomeModule2(), new SomeModule());
            FinalModuleTests(reverseKernel);
        }
예제 #5
0
        public void CanLoadOneModule()
        {
            var kernel = KernelEx.Create();

            Assert.Throws <InvalidOperationException>(() => kernel.Get <string>());
            //Assert.Throws<InvalidOperationException>(() => kernel.Get<IEnumerable<string>>());
            Assert.False(kernel.Get <IEnumerable <string> >().Any());
            Assert.False(kernel.Get <List <string> >().Any());
            kernel.Load(new SomeModule());
            Assert.Equal("test", kernel.Get <string>());
            Assert.True(kernel.Get <IEnumerable <string> >().SequenceEqual(new[] { "str1", "str2" }));
            Assert.IsType <SomeModule.SomeEnumerable>(kernel.Get <IEnumerable <string> >());
            Assert.True(kernel.Get <List <string> >().SequenceEqual(new[] { "test" }));
            kernel.Load(new SomeModule2());
            FinalModuleTests(kernel);
        }
예제 #6
0
 public RebindTests()
 {
     _kernel = KernelEx.Create();
 }
예제 #7
0
 public ResolvingTests()
 {
     _kernel = KernelEx.Create();
 }
예제 #8
0
 public ArgBindTests()
 {
     _kernel = KernelEx.Create();
 }
예제 #9
0
 public BasicBindTests()
 {
     _kernel = KernelEx.Create();
 }
예제 #10
0
 public SingletonTests()
 {
     _kernel = KernelEx.Create();
 }
예제 #11
0
 public DerivedBindTests()
 {
     _kernel = KernelEx.Create();
 }
예제 #12
0
 public InjectionTests()
 {
     _kernel = KernelEx.Create();
 }