Beispiel #1
0
        public IReadOnlyList <MethodGroup> DiscoverTestMethodGroups(Assembly assembly)
        {
            RunContext.Set(options);
            var conventions = new ConventionDiscoverer(assembly).GetConventions();

            var discoveredTestMethodGroups = new List <MethodGroup>();

            foreach (var convention in conventions)
            {
                var classDiscoverer = new ClassDiscoverer(convention);
                var candidateTypes  = assembly.GetTypes();
                var testClasses     = classDiscoverer.TestClasses(candidateTypes);

                var methodDiscoverer = new MethodDiscoverer(convention);
                foreach (var testClass in testClasses)
                {
                    var distinctMethodGroups = new Dictionary <string, MethodGroup>();

                    foreach (var testMethod in methodDiscoverer.TestMethods(testClass))
                    {
                        var methodGroup = new MethodGroup(testMethod);

                        distinctMethodGroups[methodGroup.FullName] = methodGroup;
                    }

                    discoveredTestMethodGroups.AddRange(distinctMethodGroups.Values);
                }
            }

            return(discoveredTestMethodGroups);
        }
Beispiel #2
0
        public IReadOnlyList<MethodGroup> DiscoverTestMethodGroups(Assembly assembly)
        {
            RunContext.Set(options);
            var conventions = new ConventionDiscoverer(assembly).GetConventions();

            var discoveredTestMethodGroups = new List<MethodGroup>();

            foreach (var convention in conventions)
            {
                var classDiscoverer = new ClassDiscoverer(convention);
                var candidateTypes = assembly.GetTypes();
                var testClasses = classDiscoverer.TestClasses(candidateTypes);

                var methodDiscoverer = new MethodDiscoverer(convention);
                foreach (var testClass in testClasses)
                {
                    var distinctMethodGroups = new Dictionary<string, MethodGroup>();

                    foreach (var testMethod in methodDiscoverer.TestMethods(testClass))
                    {
                        var methodGroup = new MethodGroup(testMethod);

                        distinctMethodGroups[methodGroup.FullName] = methodGroup;
                    }

                    discoveredTestMethodGroups.AddRange(distinctMethodGroups.Values);
                }
            }

            return discoveredTestMethodGroups;
        }
Beispiel #3
0
        public ClassRunner(Listener listener, Configuration config)
        {
            this.listener = listener;
            executionPlan = new ExecutionPlan(config);
            methodDiscoverer = new MethodDiscoverer(config);
            parameterDiscoverer = new ParameterDiscoverer(config);
            assertionLibraryFilter = new AssertionLibraryFilter(config);

            skipRules = config.SkipRules;
            orderCases = config.OrderCases;
        }
Beispiel #4
0
        public ClassRunner(Bus bus, Discovery discovery, Execution execution)
        {
            var config = discovery.Config;

            this.bus            = bus;
            this.execution      = execution;
            methodDiscoverer    = new MethodDiscoverer(discovery);
            parameterDiscoverer = new ParameterDiscoverer(discovery);

            orderMethods = config.OrderMethods;
        }
Beispiel #5
0
        public ClassRunner(Listener listener, Configuration config)
        {
            this.listener          = listener;
            executionPlan          = new ExecutionPlan(config);
            methodDiscoverer       = new MethodDiscoverer(config);
            parameterDiscoverer    = new ParameterDiscoverer(config);
            assertionLibraryFilter = new AssertionLibraryFilter(config);

            skipRules  = config.SkipRules;
            orderCases = config.OrderCases;
        }
Beispiel #6
0
        public ClassRunner(Listener listener, Convention convention)
        {
            var config = convention.Config;

            this.listener = listener;
            executionPlan = new ExecutionPlan(convention);
            methodDiscoverer = new MethodDiscoverer(convention);
            parameterDiscoverer = new ParameterDiscoverer(convention);
            assertionLibraryFilter = new AssertionLibraryFilter(convention);

            skipBehaviors = config.SkipBehaviors;
            orderCases = config.OrderCases;
        }
Beispiel #7
0
        public ClassRunner(Listener listener, Convention convention)
        {
            var config = convention.Config;

            this.listener          = listener;
            executionPlan          = new ExecutionPlan(convention);
            methodDiscoverer       = new MethodDiscoverer(convention);
            parameterDiscoverer    = new ParameterDiscoverer(convention);
            assertionLibraryFilter = new AssertionLibraryFilter(convention);

            skipBehaviors = config.SkipBehaviors;
            orderCases    = config.OrderCases;
        }
Beispiel #8
0
        public void DiscoverMethods(Assembly assembly)
        {
            var discovery = new BehaviorDiscoverer(assembly, customArguments).GetDiscovery();

            try
            {
                var classDiscoverer = new ClassDiscoverer(discovery);
                var candidateTypes  = assembly.GetTypes();
                var testClasses     = classDiscoverer.TestClasses(candidateTypes);

                var methodDiscoverer = new MethodDiscoverer(discovery);
                foreach (var testClass in testClasses)
                {
                    foreach (var testMethod in methodDiscoverer.TestMethods(testClass))
                    {
                        bus.Publish(new MethodDiscovered(testMethod));
                    }
                }
            }
            finally
            {
                discovery.Dispose();
            }
        }