コード例 #1
0
        /// <summary>
        /// Compose an instance of TestClassBuilder class.
        /// </summary>
        /// <param name="assembly">The assembly which types should be used.</param>
        /// <param name="callingAssemblyName">Name of calling assembly, which is set in <paramref name="assembly"/> in attribute InternalsVisibleTo.</param>
        /// <param name="typeRegistration">The action where the type registration is set up.</param>
        /// <param name="configure">The action where the configuration is set up.</param>
        /// <returns>The instance of <see cref="ITestClassBuilder"/>.</returns>
        public static ITestClassBuilder ComposeTestClassBuilder(this Assembly assembly,
                                                                string callingAssemblyName,
                                                                Action <IContainer> typeRegistration,
                                                                Action <ITestMethodGeneratorConfigurator> configure = null)
        {
            var assemblyTraverser            = AssemblyTraverser.Create(assembly, callingAssemblyName);
            var generatorRegistrationManager = new GeneratorRegistrationManager();
            var testGeneratorConfigurator    = new TestMethodGeneratorConfigurator(assemblyTraverser, generatorRegistrationManager);
            var setup          = new TestMethodGeneratorComposition(assemblyTraverser, testGeneratorConfigurator, generatorRegistrationManager);
            var testGenerators = setup.GetGenerators(typeRegistration, configure);

            return(new TestClassBuilder(assemblyTraverser, testGenerators));
        }
コード例 #2
0
 public TestMethodGeneratorComposition(IAssemblyTraverser traverser, TestMethodGeneratorConfigurator configurator, GeneratorRegistrationManager generatorRegistrationManager)
 {
     this.configurator = configurator;
     this.traverser    = traverser;
     this.generatorRegistrationManager = generatorRegistrationManager;
 }