/// <inheritdoc />
 protected override PatternTest CreateTest(PatternEvaluationScope constainingScope, ITypeInfo type)
 {
     PatternTest test = base.CreateTest(constainingScope, type);
     test.Name = NameSanitizer.MakeNameFromIdentifier(test.Name);
     test.Kind = NBehaveTestKinds.Concern;
     return test;
 }
 /// <inheritdoc />
 protected override PatternTest CreateTest(PatternEvaluationScope containingScope, IMethodInfo method)
 {
     PatternTest test = base.CreateTest(containingScope, method);
     test.Name = NameSanitizer.MakeNameFromIdentifier(test.Name);
     test.Kind = NBehaveTestKinds.Specification;
     return test;
 }
        /// <inheritdoc />
        protected override void Validate(PatternEvaluationScope containingScope, IMethodInfo method)
        {
            base.Validate(containingScope, method);

            if (!containingScope.IsTestDeclaration
                || containingScope.Test.Kind != NBehaveTestKinds.Context)
                throw new PatternUsageErrorException("The [TearDown] attribute can only appear on a method within a context class.");
        }
 /// <inheritdoc />
 protected override void DecorateContainingScope(PatternEvaluationScope containingScope, IMethodInfo method)
 {
     containingScope.Test.TestInstanceActions.TearDownTestInstanceChain.After(
         delegate(PatternTestInstanceState testInstanceState)
         {
             testInstanceState.InvokeFixtureMethod(method, EmptyArray<KeyValuePair<ISlotInfo, object>>.Instance);
         });
 }
 /// <inheritdoc />
 protected override void DecorateContainingScope(PatternEvaluationScope containingScope, IMethodInfo method)
 {
     containingScope.Test.TestInstanceActions.SetUpTestInstanceChain.Before(
         delegate(PatternTestInstanceState testInstanceState)
     {
         testInstanceState.InvokeFixtureMethod(method, EmptyArray <KeyValuePair <ISlotInfo, object> > .Instance);
     });
 }
        /// <inheritdoc />
        protected override PatternTest CreateTest(PatternEvaluationScope containingScope, IMethodInfo method)
        {
            PatternTest test = base.CreateTest(containingScope, method);

            test.Name = NameSanitizer.MakeNameFromIdentifier(test.Name);
            test.Kind = NBehaveTestKinds.Specification;
            return(test);
        }
Example #7
0
        /// <inheritdoc />
        protected override PatternTest CreateTest(PatternEvaluationScope constainingScope, ITypeInfo type)
        {
            PatternTest test = base.CreateTest(constainingScope, type);

            test.Name = NameSanitizer.MakeNameFromIdentifier(test.Name);
            test.Kind = NBehaveTestKinds.Concern;
            return(test);
        }
Example #8
0
        /// <inheritdoc />
        protected override void Validate(PatternEvaluationScope containingScope, IMethodInfo method)
        {
            base.Validate(containingScope, method);

            if (!containingScope.IsTestDeclaration ||
                containingScope.Test.Kind != NBehaveTestKinds.Context)
            {
                throw new PatternUsageErrorException("The [SetUp] attribute can only appear on a method within a context class.");
            }
        }
Example #9
0
 /// <inheritdoc />
 protected override void DecorateContainingScope(PatternEvaluationScope containingScope, IMethodInfo method)
 {
     containingScope.Test.TestInstanceActions.DecorateChildTestChain.After(
         delegate(PatternTestInstanceState testInstanceState, PatternTestActions decoratedChildActions)
         {
             decoratedChildActions.TestInstanceActions.SetUpTestInstanceChain.Before(delegate
             {
                 testInstanceState.InvokeFixtureMethod(method, EmptyArray<KeyValuePair<ISlotInfo, object>>.Instance);
             });
         });
 }
Example #10
0
 /// <inheritdoc />
 protected override void DecorateContainingScope(PatternEvaluationScope containingScope, IMethodInfo method)
 {
     containingScope.Test.TestInstanceActions.DecorateChildTestChain.After(
         delegate(PatternTestInstanceState testInstanceState, PatternTestActions decoratedChildActions)
     {
         decoratedChildActions.TestInstanceActions.TearDownTestInstanceChain.After(delegate
         {
             testInstanceState.InvokeFixtureMethod(method, EmptyArray <KeyValuePair <ISlotInfo, object> > .Instance);
         });
     });
 }
        /// <inheritdoc />
        protected override void DecorateTest(PatternEvaluationScope scope, ICodeElementInfo codeElement)
        {
            scope.Test.Metadata.Add(MetadataKeys.ExplicitReason, reason);

            scope.Test.TestActions.InitializeTestChain.Before(delegate(PatternTestState state)
            {
                if (!state.IsExplicit)
                {
                    string message = "The specification will not run unless explicitly selected.";
                    if (reason.Length != 0)
                        message += "\nReason: " + reason;

                    throw new SilentTestException(TestOutcome.Explicit, message);
                }
            });
        }
Example #12
0
        /// <inheritdoc />
        protected override void DecorateTest(PatternEvaluationScope scope, ICodeElementInfo codeElement)
        {
            scope.Test.Metadata.Add(MetadataKeys.ExplicitReason, reason);

            scope.Test.TestActions.InitializeTestChain.Before(delegate(PatternTestState state)
            {
                if (!state.IsExplicit)
                {
                    string message = "The specification will not run unless explicitly selected.";
                    if (reason.Length != 0)
                    {
                        message += "\nReason: " + reason;
                    }

                    throw new SilentTestException(TestOutcome.Explicit, message);
                }
            });
        }
        /// <inheritdoc />
        protected override void InitializeTest(PatternEvaluationScope typeScope, ITypeInfo type)
        {
            base.InitializeTest(typeScope, type);

            typeScope.Test.Metadata.Add(NBehaveMetadataKeys.Concern, typeScope.Test.Name);
        }
Example #14
0
        /// <inheritdoc />
        protected override void InitializeTest(PatternEvaluationScope typeScope, ITypeInfo type)
        {
            base.InitializeTest(typeScope, type);

            typeScope.Test.Metadata.Add(NBehaveMetadataKeys.Concern, typeScope.Test.Name);
        }