Beispiel #1
0
        public static Runner Create(string platformId, IEnumerable<Assembly> assemblies)
        {
            var runner = new Runner(platformId);

            foreach (var assembly in assemblies)
            {
                var assemblyMeta = new AssemblyMeta(assembly);

                runner.Assemblies.Add(assemblyMeta);

                var generators = assembly.GetCustomAttributes(true)
                                         .OfType<TestFixtureDiscoveryAttributeBase>().ToList();
                generators.Add(new DefaultDiscovery());
                foreach (var generator in generators)
                {
                    foreach (var fixture in generator.Generator(assembly))
                    {
                        assemblyMeta.Fixtures.Add(fixture);

                        foreach (var testHarness in fixture.GetHarnesses())
                        {

                            int i = 0;
                            foreach (var constructorSet in fixture.ParameterSets())
                            {
                                int j = 0;
                                constructorSet.Index = i++;
                                foreach (var testSet in testHarness.ParameterSets())
                                {
                                    testSet.Index = j++;
                                    var test = new Test(fixture, constructorSet,
                                                        testHarness, testSet);
                                    fixture.Tests.Add(test);
                                    runner.Tests.Add(test);
                                }
                            }
                        }
                    }
                }
            }

            return runner;
        }
Beispiel #2
0
        public static Runner Create(string platformId, IEnumerable <Assembly> assemblies)
        {
            var runner = new Runner(platformId);

            foreach (var assembly in assemblies)
            {
                var assemblyMeta = new AssemblyMeta(assembly);

                runner.Assemblies.Add(assemblyMeta);

                var generators = assembly.GetCustomAttributes(true)
                                 .OfType <TestFixtureDiscoveryAttributeBase>().ToList();
                generators.Add(new DefaultDiscovery());
                foreach (var generator in generators)
                {
                    foreach (var fixture in generator.Generator(assembly))
                    {
                        assemblyMeta.Fixtures.Add(fixture);

                        foreach (var testHarness in fixture.GetHarnesses())
                        {
                            int i = 0;
                            foreach (var constructorSet in fixture.ParameterSets())
                            {
                                int j = 0;
                                constructorSet.Index = i++;
                                foreach (var testSet in testHarness.ParameterSets())
                                {
                                    testSet.Index = j++;
                                    var test = new Test(fixture, constructorSet,
                                                        testHarness, testSet);
                                    fixture.Tests.Add(test);
                                    runner.Tests.Add(test);
                                }
                            }
                        }
                    }
                }
            }

            return(runner);
        }