Exemple #1
0
        public ISuiteProvider Load(IIntent assemblyIntent)
        {
            var assembly   = Assembly.LoadFrom(assemblyIntent.Identity.Absolute);
            var provider   = SuiteProvider.Create(assemblyIntent.Identity, assembly.GetName().Name, ignored: false);
            var controller = _suiteControllerFactory.Create(provider);

            var explorationData = _assemblyExplorer.Explore(assembly);

            var lazyBootstraps = explorationData.BootstrapTypes.Select(x => new TypedLazy <ILazyBootstrap>(x)).ToList();
            var suiteTypes     = Filter(assemblyIntent, explorationData.SuiteTypes);

            provider.SuiteProviders = suiteTypes.Select(x => Load(x, explorationData.TypeLoaders, lazyBootstraps, provider.Identity));
            lazyBootstraps
            .Where(x => x.IsValueCreated)
            .Select(x => x.Value)
            .ForEach(
                x =>
                controller.AddSetupCleanup <SetupCommon, CleanupCommon>(
                    x.GetType().Name + ".Setup",
                    x.Setup,
                    x.GetType().Name + ".Cleanup",
                    x.Cleanup));

            return(provider);
        }
Exemple #2
0
        public ISuiteProvider Load(IIntent assemblyIntent)
        {
            var assembly   = Assembly.LoadFrom(assemblyIntent.Identity.Absolute);
            var provider   = SuiteProvider.Create(assemblyIntent.Identity, assembly.GetName().Name, ignoreReason: null);
            var controller = _suiteControllerFactory.Create(provider);

            var explorationData = _assemblyExplorer.Explore(assembly);

            var suiteProviders = LoadSuiteProviders(
                assemblyIntent,
                explorationData.TestLoaderFactories.ToList(),
                explorationData.PotentialSuiteTypes.ToList(),
                explorationData.AssemblySetupTypes);

            provider.SuiteProviders = suiteProviders;
            explorationData.AssemblySetupTypes.Values
            .Where(x => x.IsValueCreated)
            .Select(x => x.Value)
            .ForEach(
                x => controller.AddSetupCleanup <SetupCommon, CleanupCommon>(
                    x.GetType().Name + ".Setup",
                    x.Setup,
                    x.GetType().Name + ".Cleanup",
                    x.Cleanup));

            return(provider);
        }