blob: 73086eef1c27c75bd929e9622b4c2aa1e3425eba [file] [log] [blame]
using System;
namespace AppsheetEpplus;
public class ValidationResult : IValidationResult {
public ValidationResult(bool result)
: this(result, null) {}
public ValidationResult(bool result, string errorMessage) {
_result = result;
_errorMessage = errorMessage;
}
private readonly bool _result;
private readonly string _errorMessage;
private void Throw() {
if (string.IsNullOrEmpty(_errorMessage)) {
throw new InvalidOperationException();
}
throw new InvalidOperationException(_errorMessage);
}
void IValidationResult.IsTrue() {
if (!_result) {
Throw();
}
}
void IValidationResult.IsFalse() {
if (_result) {
Throw();
}
}
}