public void InstanceTypeLifeCycle()
        {
            IContainer container = new IocContainer.Container();

            // testing instance type resigtration for class
            container.RegisterInstanceType <ITest2, ClassTest2>();

            ITest2 obj1 = container.Resolve <ITest2>();

            container.RegisterInstanceType <ITest2, ClassTest2>();
            ITest2 obj2 = container.Resolve <ITest2>();

            Assert.NotEqual(obj2.Hash(), obj1.Hash());
        }
        public void NestedDependency()
        {
            IContainer container = new IocContainer.Container();

            container.RegisterInstanceType <ITest1, ClassTest1>();

            ITest1 obj2 = container.Resolve <ITest1>();

            container.RegisterInstanceType <One, ClassOne>();
            One obj1 = container.Resolve <One>();

            Assert.Equal("ClassOne", obj1.FunctionOne());
            Assert.Equal("ClassTest1", obj1.FunctionTwo());
        }
        public static void RegisterRoutes(RouteCollection routes)
        {
            var container = new IocContainer.Container();

            container.RegisterInstanceType <IndexController, IndexController>();

            container.RegisterInstanceType <IIndex, IndexModel>();
            ControllerBuilder.Current.SetControllerFactory(new SimpleIocController(container));


            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Index", action = "Index", id = UrlParameter.Optional }                //
                );
        }
        public void InstanceTypeResigtration()
        {
            IContainer container = new IocContainer.Container();

            // testing instance type resigtration for class
            container.RegisterInstanceType <ITest1, ClassTest1>();

            ITest1 obj1 = container.Resolve <ITest1>();

            Assert.Equal("ClassTest1", obj1.Name());
        }