public void Register()
        {
            var Temp = new Utilities.IoC.Default.DefaultBootstrapper(AppDomain.CurrentDomain.GetAssemblies(), AppDomain.CurrentDomain.GetAssemblies().Types());

            Temp.Register(new TestClass()
            {
                A = 12
            });
            Assert.Equal(12, Temp.Resolve <TestClass>().A);
            Temp.Register <TestClass>();
            Assert.Equal(0, Temp.Resolve <TestClass>().A);
            Temp.Register(() => new TestClass()
            {
                A = 12
            });
            Assert.Equal(12, Temp.Resolve <TestClass>().A);
            Temp.Register <ITestClass, TestClass>();
            Assert.Equal(0, Temp.Resolve <ITestClass>().A);
            Temp.Register(new TestClass()
            {
                A = 21
            }, "Test");
            Assert.Equal(21, Temp.Resolve <TestClass>("Test").A);
            Assert.Equal(0, Temp.Resolve <ITestClass>().A);
            Assert.Equal(12, Temp.Resolve <TestClass>().A);
        }
 public void Resolve()
 {
     var Temp = new Utilities.IoC.Default.DefaultBootstrapper(AppDomain.CurrentDomain.GetAssemblies(), AppDomain.CurrentDomain.GetAssemblies().Types());
     Temp.Register(new TestClass() { A = 12 });
     Assert.Equal(12, Temp.Resolve<TestClass>().A);
     Assert.Equal(12, Temp.Resolve<TestClass>("").A);
     Assert.Equal(12, ((TestClass)Temp.Resolve(typeof(TestClass), "")).A);
 }
 public void RegisterAll()
 {
     var Temp = new Utilities.IoC.Default.DefaultBootstrapper(new Assembly[] { typeof(DefaultBootstrapper).Assembly }, typeof(DefaultBootstrapper).Assembly.GetTypes());
     Temp.RegisterAll<ITestClass>();
     Assert.Null(Temp.Resolve<ITestClass>());
     Assert.Equal(2, Temp.ResolveAll<ITestClass>().Count());
     Assert.NotNull(Temp.Resolve<TestClass>());
     Assert.NotNull(Temp.Resolve<TestClass2>());
 }
 public void IEnumerableConstructor()
 {
     var Temp = new Utilities.IoC.Default.DefaultBootstrapper(AppDomain.CurrentDomain.GetAssemblies(), AppDomain.CurrentDomain.GetAssemblies().Types());
     Temp.RegisterAll<ITestClass>();
     Temp.Register<TestClass3>();
     TestClass3 Object = Temp.Resolve<TestClass3>();
     Assert.NotNull(Object);
     Assert.Equal(2, Object.Classes.Count());
 }
        public void RegisterAll()
        {
            var Temp = new Utilities.IoC.Default.DefaultBootstrapper(new Assembly[] { typeof(DefaultBootstrapper).Assembly }, typeof(DefaultBootstrapper).Assembly.GetTypes());

            Temp.RegisterAll <ITestClass>();
            Assert.Null(Temp.Resolve <ITestClass>());
            Assert.Equal(2, Temp.ResolveAll <ITestClass>().Count());
            Assert.NotNull(Temp.Resolve <TestClass>());
            Assert.NotNull(Temp.Resolve <TestClass2>());
        }
        public void IEnumerableConstructor()
        {
            var Temp = new Utilities.IoC.Default.DefaultBootstrapper(AppDomain.CurrentDomain.GetAssemblies(), AppDomain.CurrentDomain.GetAssemblies().Types());

            Temp.RegisterAll <ITestClass>();
            Temp.Register <TestClass3>();
            TestClass3 Object = Temp.Resolve <TestClass3>();

            Assert.NotNull(Object);
            Assert.Equal(2, Object.Classes.Count());
        }
Exemplo n.º 7
0
        public void Resolve()
        {
            var Temp = new Utilities.IoC.Default.DefaultBootstrapper(AppDomain.CurrentDomain.GetAssemblies(), AppDomain.CurrentDomain.GetAssemblies().Types());

            Temp.Register(new TestClass {
                A = 12
            });
            Assert.Equal(12, Temp.Resolve <TestClass>().A);
            Assert.Equal(12, Temp.Resolve <TestClass>("").A);
            Assert.Equal(12, ((TestClass)Temp.Resolve(typeof(TestClass), "")).A);
        }
 public void ResolveAll()
 {
     var Temp = new Utilities.IoC.Default.DefaultBootstrapper(AppDomain.CurrentDomain.GetAssemblies(), AppDomain.CurrentDomain.GetAssemblies().Types());
     Temp.Register(new TestClass() { A = 12 });
     Temp.Register(new TestClass() { A = 13 }, "A");
     Temp.Register(new TestClass() { A = 14 }, "B");
     IEnumerable<TestClass> Objects = Temp.ResolveAll<TestClass>();
     Assert.Equal(3, Objects.Count());
     foreach (TestClass Object in Objects)
     {
         Assert.Contains(Object.A, new int[] { 12, 13, 14 });
     }
 }
 public void Register()
 {
     var Temp = new Utilities.IoC.Default.DefaultBootstrapper(AppDomain.CurrentDomain.GetAssemblies(), AppDomain.CurrentDomain.GetAssemblies().Types());
     Temp.Register(new TestClass() { A = 12 });
     Assert.Equal(12, Temp.Resolve<TestClass>().A);
     Temp.Register<TestClass>();
     Assert.Equal(0, Temp.Resolve<TestClass>().A);
     Temp.Register(() => new TestClass() { A = 12 });
     Assert.Equal(12, Temp.Resolve<TestClass>().A);
     Temp.Register<ITestClass, TestClass>();
     Assert.Equal(0, Temp.Resolve<ITestClass>().A);
     Temp.Register(new TestClass() { A = 21 }, "Test");
     Assert.Equal(21, Temp.Resolve<TestClass>("Test").A);
     Assert.Equal(0, Temp.Resolve<ITestClass>().A);
     Assert.Equal(12, Temp.Resolve<TestClass>().A);
 }
Exemplo n.º 10
0
        public void ResolveAll()
        {
            var Temp = new Utilities.IoC.Default.DefaultBootstrapper(AppDomain.CurrentDomain.GetAssemblies(), AppDomain.CurrentDomain.GetAssemblies().Types());

            Temp.Register(new TestClass {
                A = 12
            });
            Temp.Register(new TestClass {
                A = 13
            }, "A");
            Temp.Register(new TestClass {
                A = 14
            }, "B");
            var Objects = Temp.ResolveAll <TestClass>();

            Assert.Equal(3, Objects.Count());
            foreach (TestClass Object in Objects)
            {
                Assert.Contains(Object.A, new int[] { 12, 13, 14 });
            }
        }
 public void Creation()
 {
     var Temp = new Utilities.IoC.Default.DefaultBootstrapper(AppDomain.CurrentDomain.GetAssemblies(), AppDomain.CurrentDomain.GetAssemblies().Types());
     Assert.Equal("Default bootstrapper", Temp.Name);
 }
        public void Creation()
        {
            var Temp = new Utilities.IoC.Default.DefaultBootstrapper(AppDomain.CurrentDomain.GetAssemblies(), AppDomain.CurrentDomain.GetAssemblies().Types());

            Assert.Equal("Default bootstrapper", Temp.Name);
        }