Пример #1
0
        public void OnlyHasFeature_ShouldCorrectOrder()
        {
            var moduleManager = new MiCakeModuleManager();

            moduleManager.AddFeatureModule(typeof(FeatureModuleA));
            moduleManager.AddFeatureModule(typeof(FeatureModuleBDepencyModuleA));
            moduleManager.AddFeatureModule(typeof(FeatureModuleCDencyModuleB));
            moduleManager.PopulateModules(typeof(StartUpModule_NoDenpency));
            var moduleContext = moduleManager.ModuleContext;

            var allmodules = moduleContext.AllModules;

            Assert.Equal(4, allmodules.Count);

            var defaultModules = moduleContext.MiCakeModules;

            Assert.Equal(1, defaultModules.Count);

            var featureModules = moduleContext.FeatureModules;

            Assert.Equal(3, featureModules.Count);

            //order
            var firstModule = moduleContext.FeatureModules.FirstOrDefault();

            Assert.NotNull(firstModule);
            Assert.Equal(typeof(FeatureModuleA), firstModule.ModuleType);

            var lastModule = moduleContext.FeatureModules.LastOrDefault();

            Assert.NotNull(lastModule);
            Assert.Equal(typeof(FeatureModuleCDencyModuleB), lastModule.ModuleType);
        }
Пример #2
0
        public void HasFeature_ShouldLoadAddedFeatureModule()
        {
            var moduleManager = new MiCakeModuleManager();

            moduleManager.AddFeatureModule(typeof(FeatureModuleA));
            moduleManager.PopulateModules(typeof(StartUpModule_NoDenpency));
            var moduleContext = moduleManager.ModuleContext;

            var allmodules = moduleContext.AllModules;

            Assert.Equal(2, allmodules.Count);

            var defaultModules = moduleContext.MiCakeModules;

            Assert.Equal(1, defaultModules.Count);

            var featureModules = moduleContext.FeatureModules;

            Assert.Equal(1, featureModules.Count);
        }
Пример #3
0
        public void OnlyMiCakeModule_ShouldErrorInCheckFeatureModule()
        {
            var moduleManager = new MiCakeModuleManager();

            Assert.ThrowsAny <Exception>(() => moduleManager.AddFeatureModule(typeof(StartUpModule)));
        }