示例#1
0
        public MunqContext()
        {
            var mq = new MunqContainer();

            mine = mq;
            old  = Dependency.SetResolver(mine);
        }
示例#2
0
 public static void InitializeServiceLocator()
 {
     if (!Dependency.HasResolver)
     {
         var container = new MunqContainer();
         Dependency.SetResolver(container);
     }
 }
示例#3
0
 public void Dependency_Resolver_ReturnsObjectSetBySetResolverMethod()
 {
     try
     {
         var container1 = new MunqContainer();
         Dependency.SetResolver(container1);
         Assert.Equal(container1, Dependency.Resolver);
         var container2 = new MunqContainer();
         Dependency.SetResolver(container2);
         Assert.Equal(container2, Dependency.Resolver);
         Dependency.SetResolver(null);
         Assert.False(Dependency.HasResolver);
     }
     finally
     {
         Dependency.SetResolver(null);
     }
 }
示例#4
0
 public void Dependency_Resolver_ReturnsObjectSetBySetResolverMethod()
 {
     try
     {
         var container1 = new MunqContainer();
         Dependency.SetResolver(container1);
         Assert.Equal(container1, Dependency.Resolver);
         var container2 = new MunqContainer();
         Dependency.SetResolver(container2);
         Assert.Equal(container2, Dependency.Resolver);
         Dependency.SetResolver(null);
         Assert.False(Dependency.HasResolver);
     }
     finally
     {
         Dependency.SetResolver(null);
     }
 }
示例#5
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     AutoFacRegister.Register();
     AutoMapperConfig.Initialize();
     Database.SetInitializer(new CreateDatabaseIfNotExists <EdoDbContext>());
     if (!Dependency.HasResolver)
     {
         var container = new MunqContainer();
         Dependency.SetResolver(container);
         var registrar = Dependency.Resolve <IDependencyRegistrar>();
         registrar.RegisterInstance <ILocalTextRegistry>(new LocalTextRegistry());
     }
     CommonInitialization.Run();
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
示例#6
0
        public void Dependency_SetResolver_ReturnsPriorResolver()
        {
            try
            {
                var container1 = new MunqContainer();
                var before1    = Dependency.SetResolver(container1);
                Assert.Null(before1);

                var container2 = new MunqContainer();
                var before2    = Dependency.SetResolver(container2);
                Assert.Equal(container1, before2);

                var before3 = Dependency.SetResolver(null);
                Assert.Equal(container2, before3);
            }
            finally
            {
                Dependency.SetResolver(null);
            }
        }
示例#7
0
        public void Dependency_SetResolver_ReturnsPriorResolver()
        {
            try
            {
                var container1 = new MunqContainer();
                var before1 = Dependency.SetResolver(container1);
                Assert.Null(before1);

                var container2 = new MunqContainer();
                var before2 = Dependency.SetResolver(container2);
                Assert.Equal(container1, before2);

                var before3 = Dependency.SetResolver(null);
                Assert.Equal(container2, before3);
            }
            finally
            {
                Dependency.SetResolver(null);
            }
        }
示例#8
0
 public MunqContext()
 {
     var mq = new MunqContainer();
     mine = mq;
     old = Dependency.SetResolver(mine);
 }