Beispiel #1
0
        /// <summary>
        /// Executes this Step.
        /// </summary>
        /// <returns>the resulting result</returns>
        public Result Execute()
        {
            var t = this.tags ?? Enumerable.Empty <string>();

            if (!this.IsExecutable)
            {
                return(Result.ForResultType(this.Prefix, this.IndentLevel, this.Text, t, ResultType.NotExecutable));
            }

            try
            {
                this.Action();
                return(Result.ForResultType(this.Prefix, this.IndentLevel, this.Text, t, ResultType.Passed));
            }
            catch (NotImplementedException ex)
            {
                // transform any NotImplementedException into a unit test specific "pending" exception
                var message = ex.Message == StepPendingMessage
                                     ? "Pending"
                                     : "Pending due to " + Environment.NewLine + ex;

                var pex = StoryQSettings.PendingExceptionBuilder(message, ex);
                return(Result.ForException(this.Prefix, this.IndentLevel, this.Text, t, pex, true));
            }
            catch (Exception ex)
            {
                return(Result.ForException(this.Prefix, this.IndentLevel, this.Text, t, ex, false));
            }
        }
Beispiel #2
0
        public void BuildException()
        {
            var exception = StoryQSettings.PendingExceptionBuilder("foo", null);

#if NUNIT
            //we use ignore not inconclusive for nunit (most runners turn this yellow, whereas inconclusive is red)
            Assert.IsAssignableFrom <IgnoreException>(exception);
#else
            Assert.IsTrue(exception is AssertInconclusiveException);
#endif
        }