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 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>());
        }
Пример #4
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 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 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 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 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);
 }