public override Fen Translate(string from) { if (!BypassValidation) { var fenValidator = new FENValidator(); fenValidator.Validate(from); } return(GetFenObject(from)); }
private void AssertExceptionValueSet(FENError error) { _fenRuleMock = new Mock <IFENRule>(); var mockedMethod = _fenRuleMock .Setup(x => x.Validate(It.IsAny <string>())) .Returns(error); _fenValidator = new FENValidator(_fenRuleMock.Object); try { _fenValidator.Validate(BoardConstants.FenStartingPosition); } catch (System.Exception exc) { var fenException = (FENException)exc; Assert.AreEqual(error, fenException.FENError, $"Expected fenException Error to have been {error}"); throw; } }
public void FENValidatorTest_ShouldThrowExceptionWhenInvalidFenStringDetected(FENError testCase) { _fenValidator = new FENValidator(_fenRuleMock.Object); Assert.Throws(typeof(FENException), () => AssertExceptionValueSet(testCase)); }