예제 #1
0
        /// <inheritdoc />
        protected override IValueResult ToColumnValueResult(VerifiableTableColumn column, ColumnValue expected, ColumnValue actual)
        {
            var result = VerifyExpectation(column, expected, actual);

            return(new ValueResult(
                       FormattingService.FormatValue(expected),
                       FormattingService.FormatValue(actual),
                       result ? ParameterVerificationStatus.Success : ParameterVerificationStatus.Failure,
                       result ? null : $"{column.Name}: {result.Message}"
                       ));
        }
예제 #2
0
 private ExpectationResult VerifyExpectation(VerifiableTableColumn column, ColumnValue expected, ColumnValue actual)
 {
     if (expected.HasValue && !actual.HasValue)
     {
         return(ExpectationResult.Failure("missing value"));
     }
     if (!expected.HasValue && actual.HasValue)
     {
         return(ExpectationResult.Failure("unexpected value"));
     }
     return(column.Expectation.Invoke(expected.Value).Verify(actual.Value, FormattingService));
 }
예제 #3
0
 /// <summary>
 /// Provides <see cref="IValueResult"/> representation of column value comparison.
 /// </summary>
 /// <param name="column">Column definition.</param>
 /// <param name="expected">Expected value.</param>
 /// <param name="actual">Actual value</param>
 protected abstract IValueResult ToColumnValueResult(VerifiableTableColumn column, ColumnValue expected, ColumnValue actual);