/// <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}" )); }
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)); }
/// <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);