예제 #1
0
 public ExecutionPlan(Configuration config)
 {
     classBehaviors =
         BuildClassBehaviorChain(config,
             BuildFixtureBehaviorChain(config,
                 BuildCaseBehaviorChain(config)));
 }
예제 #2
0
        static ClassBehavior GetInnermostBehavior(Configuration config, BehaviorChain<Fixture> fixtureBehaviors)
        {
            if (config.ConstructionFrequency == ConstructionFrequency.PerCase)
                return new CreateInstancePerCase(config.TestClassFactory, fixtureBehaviors);

            return new CreateInstancePerClass(config.TestClassFactory, fixtureBehaviors);
        }
예제 #3
0
        static BehaviorChain<Case> BuildCaseBehaviorChain(Configuration config)
        {
            var chain = config.CustomCaseBehaviors
                .Select(customBehavior => customBehavior())
                .ToList();

            chain.Add(new InvokeMethod());

            return new BehaviorChain<Case>(chain);
        }
예제 #4
0
        static BehaviorChain<Fixture> BuildFixtureBehaviorChain(Configuration config, BehaviorChain<Case> caseBehaviors)
        {
            var chain = config.CustomFixtureBehaviors
                .Select(customBehavior => customBehavior())
                .ToList();

            chain.Add(new ExecuteCases(caseBehaviors));

            return new BehaviorChain<Fixture>(chain);
        }
예제 #5
0
        static BehaviorChain<Class> BuildClassBehaviorChain(Configuration config, BehaviorChain<Fixture> fixtureBehaviors)
        {
            var chain = config.CustomClassBehaviors
                .Select(customBehavior => customBehavior())
                .ToList();

            chain.Add(GetInnermostBehavior(config, fixtureBehaviors));

            return new BehaviorChain<Class>(chain);
        }
예제 #6
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;
        }
예제 #7
0
        public Convention()
        {
            Config = new Configuration();

            Classes = new ClassExpression(Config);
            Methods = new MethodExpression(Config);;
            Parameters = new ParameterSourceExpression(Config);
            CaseExecution = new CaseBehaviorExpression(Config);
            FixtureExecution = new FixtureBehaviorExpression(Config);
            ClassExecution = new ClassBehaviorExpression(Config);
            HideExceptionDetails = new AssertionLibraryExpression(Config);
        }
예제 #8
0
        public AssertionLibraryFilter(Configuration config)
        {
            exceptionTypes = new List<Type>();
            stackTraceTypes = new List<Type>();

            foreach (var type in config.AssertionLibraryTypes)
            {
                bool isExceptionType = type.IsSubclassOf(typeof(Exception));

                if (isExceptionType)
                    exceptionTypes.Add(type);
                else
                    stackTraceTypes.Add(type);
            }
        }
예제 #9
0
 public MethodDiscoverer(Configuration config)
 {
     testMethodConditions = config.TestMethodConditions.ToArray();
 }
예제 #10
0
 public ClassDiscoverer(Configuration config)
 {
     testClassConditions = config.TestClassConditions.ToArray();
 }
예제 #11
0
 public ParameterDiscoverer(Configuration config)
 {
     parameterSources = config.ParameterSources
         .Select(sourceType => sourceType())
         .ToArray();
 }