public FENError Validate(string fen) { fen = FENHelpers.SanitizeFenString(fen); foreach (var rule in _rules) { var rv = rule.Validate(fen); if (rv != FENError.None) { throw new FENException(fen, rv); } } return(FENError.None); }
public FENError Validate(string fen) { fen = FENHelpers.SanitizeFenString(fen); if (string.IsNullOrEmpty(fen)) { return(FENError.InvalidFENString); } var splitSectionsLength = fen.Split(SeperationCharacter).Length; if (splitSectionsLength != 6) { return(FENError.InvalidFENString); } return(FENError.None); }
protected static IEnumerable <TestCase <CastlingAvailability, CastlingAvailability> > GetCastlingAbilityTestCases() { var max = 15ul; var permutations = MovingPieceService.GetAllPermutationsOfSetBits(max.GetSetBits(), 0, 0); var castlingCartesian = permutations.Distinct() .Select(x => (CastlingAvailability)x) .Select(x => new TestCase <CastlingAvailability, CastlingAvailability>(x, x, $"{FENHelpers.MakeCastlingAvailabilityStringFromBitFlags(x)}")).ToArray(); return(castlingCartesian); }