示例#1
0
 private void verifyTheActualValue(IStep step, object actual, string rawExpected, ITestContext context)
 {
     try
     {
         object expected = context.Finder.FromString(rawExpected, _type);
         checkExpectedAgainstActual(expected, actual, context, step);
     }
     catch (Exception e)
     {
         context.ResultsFor(step).MarkExceptionField(e.ToString(), _key);
         context.IncrementSyntaxErrors();
     }
 }
示例#2
0
        private void readArgument(Action <object> continuation, IStep step, ITestContext context)
        {
            var results = context.ResultsFor(step);

            string rawValue = step.Get(_key) ?? _defaultValue;

            if (rawValue.IsEmpty())
            {
                if (IsBooleanResult())
                {
                    step.Set(_key, true);
                    continuation(true);
                    return;
                }

                results.MarkMissingValue(_key);
                context.IncrementSyntaxErrors();
                return;
            }

            try
            {
                object value = context.Finder.FromString(rawValue, _type);
                continuation(value);
            } // TODO -- eliminate duplication
            catch (FormatException)
            {
                context.IncrementSyntaxErrors();
                results.MarkFormatFailure(_key);
            }
            catch (Exception ex)
            {
                if (ex.InnerException is FormatException)
                {
                    context.IncrementSyntaxErrors();
                    results.MarkFormatFailure(_key);
                }
            }
        }
示例#3
0
        public void RecordActual(object actual, IStep step, ITestContext context)
        {
            var results = context.ResultsFor(step);

            results.SetActual(_key, actual);

            string rawExpected = GetRawExpected(step);


            if (rawExpected == null)
            {
                context.IncrementSyntaxErrors();
                results.MarkMissingValue(_key);
                return;
            }

            verifyTheActualValue(step, actual, rawExpected, context);
        }