コード例 #1
0
        public void ShouldSetMemberfilterForMethodInfoOfTypeMethod()
        {
            StoryRunnerFilter filter = null;
            MemberInfo        member = null;

            Given(
                () =>
            {
                var stack = new StackFrame(2);         //
                member    = stack.GetMethod();
            }
                );

            When(
                () => { filter = StoryRunnerFilter.GetFilter(member); }
                );

            Then(
                () =>
            {
                Assert.That(filter.MethodNameFiler.ToString(), Is.EqualTo("^ShouldSetMemberfilterForMethodInfoOfTypeMethod$"));
                Assert.That(filter.ClassNameFilter.ToString(), Is.EqualTo("^" + typeof(StoryRunnerFilterSpecs).Name + "$"));
                Assert.That(filter.NamespaceFilter.ToString(), Is.EqualTo("^" + typeof(StoryRunnerFilterSpecs).Namespace + "$"));
            }
                );
        }
コード例 #2
0
        public static StoryRunnerFilter Context <TActionStepsClass>(this StoryRunnerFilter filter)
        {
            Type   type             = typeof(TActionStepsClass);
            string classFilterValue = filter.ClassNameFilter.UpdateWith(type.Name);
            var    namespaceFilter  = filter.NamespaceFilter.UpdateWith(type.Namespace);

            return(new StoryRunnerFilter(namespaceFilter, classFilterValue, filter.MethodNameFiler.ToString()));
        }
コード例 #3
0
 private NBehaveConfiguration(bool createAppDomain)
 {
     CreateAppDomain = createAppDomain;
     EventListener   = new NullEventListener();
     Filter          = new StoryRunnerFilter();
     TagsFilter      = new List <string[]>();
     Assemblies      = new List <string>();
 }
コード例 #4
0
		private static void Execute(this string scenario, StoryRunnerFilter filter, IEnumerable<Assembly> assemblies,
			params IEventListener[] eventListenersArg)
		{
			var eventListeners = new List<IEventListener>();
			eventListeners.AddRange(eventListenersArg);

			eventListeners.Add(new ColorfulConsoleOutputEventListener());
			eventListeners.Add(new FailSpecResultEventListener());

			var multiEventListener = new MultiOutputEventListener(eventListeners.ToArray());

			var builder = new TextScenarioRunner(multiEventListener, assemblies, filter);
			builder.Run(scenario);
		}
コード例 #5
0
        private static void Execute(this string scenario, StoryRunnerFilter filter, IEnumerable <Assembly> assemblies,
                                    params IEventListener[] eventListenersArg)
        {
            var eventListeners = new List <IEventListener>();

            eventListeners.AddRange(eventListenersArg);

            eventListeners.Add(new ColorfulConsoleOutputEventListener());
            eventListeners.Add(new FailSpecResultEventListener());

            var multiEventListener = new MultiOutputEventListener(eventListeners.ToArray());

            var builder = new TextScenarioRunner(multiEventListener, assemblies, filter);

            builder.Run(scenario);
        }
コード例 #6
0
        private TestRunState Run(Assembly assembly, MemberInfo member, ITestListener tddNetListener)
        {
            var locator = new StoryLocator
            {
                RootLocation = Path.GetDirectoryName(assembly.Location)
            };

            var type    = member as Type;
            var stories = (type == null)
                              ? locator.LocateAllStories()
                              : locator.LocateStoriesMatching(type);

            var results = NBehaveConfiguration
                          .New
                          .DontIsolateInAppDomain()
                          .SetEventListener(new StoryRunnerEventListenerProxy(tddNetListener))
                          .SetScenarioFiles(stories)
                          .SetAssemblies(new[] { assembly.Location })
                          .SetFilter(StoryRunnerFilter.GetFilter(member))
                          .Build()
                          .Run();

            return(GetTestRunState(results));
        }
コード例 #7
0
 public override void SetUp()
 {
     _storyRunnerFilter = new StoryRunnerFilter(GetType().Namespace, StoryRunnerFilter.MatchAnything, StoryRunnerFilter.MatchAnything);
     base.SetUp();
 }
コード例 #8
0
 public static StoryRunnerFilter And <TActionStepsClass>(this StoryRunnerFilter filter)
 {
     return(filter.Context <TActionStepsClass>());
 }
コード例 #9
0
 public NBehaveConfiguration SetFilter(StoryRunnerFilter filter)
 {
     Filter = filter;
     return(this);
 }
コード例 #10
0
 public override void SetUp()
 {
     _storyRunnerFilter = new StoryRunnerFilter(GetType().Namespace, ".", ".");
     base.SetUp();
 }
コード例 #11
0
 public static void Execute(this string scenario, StoryRunnerFilter filter, params IEventListener[] eventListeners)
 {
     scenario.Execute(filter, ActionStepAssemblies);
 }
コード例 #12
0
 private static void Execute(this string scenario, StoryRunnerFilter filter, params Assembly[] assemblies)
 {
     Execute(scenario, filter, assemblies, new IEventListener[] {});
 }
コード例 #13
0
		public TextScenarioRunner(IEventListener eventListener, IEnumerable<Assembly> actionStepAssemblies, StoryRunnerFilter storyRunnerFilter)
		{
			_eventListener = eventListener;
			_actionStepAssemblies = actionStepAssemblies;
			_storyRunnerFilter = storyRunnerFilter;
		}
コード例 #14
0
 public TextScenarioRunner(IEventListener eventListener, IEnumerable <Assembly> actionStepAssemblies, StoryRunnerFilter storyRunnerFilter)
 {
     _eventListener        = eventListener;
     _actionStepAssemblies = actionStepAssemblies;
     _storyRunnerFilter    = storyRunnerFilter;
 }
コード例 #15
0
		public static void Execute(this string scenario, StoryRunnerFilter filter, params IEventListener[] eventListeners)
		{
			scenario.Execute(filter, ActionStepAssemblies);
		}
コード例 #16
0
		private static void Execute(this string scenario, StoryRunnerFilter filter, params Assembly[] assemblies)
		{
			Execute(scenario, filter, assemblies, new IEventListener[] { });
		}